home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: Tape Archive
(archive/tar).
You can browse this item here: dosfsck
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Tape Archive (archive/tar)
| magic
| Supported |
100%
| file
| POSIX tar archive (GNU)
| default
| |
99%
| file
| POSIX tar archive (GNU), file dosfsck/README, mode 644 , uid 0 , gid 0 , size 2735 , seconds 5373575054, user root, group root
| default
| |
98%
| file
| data
| default
| |
62%
| TrID
| TAR - Tape ARchive (GNU)
| default
| |
37%
| TrID
| TAR - Tape ARchive (file)
| default
| |
100%
| siegfried
| x-fmt/265 Tape Archive Format
| default
| |
100%
| lsar
| Tar
| default
| |
100%
| gt2
| TAR Archiv gefunden (Auflistung ist deaktiviert)
| default
| |
100%
| disktype
| GNU tar archive
| default
| |
100%
| detectItEasy
| Archive: tar
| default
| |
100%
| binwalkID
| POSIX tar archive (GNU), owner user name: "README"
| default
| |
100%
| xdgMime
| application/x-tar
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 64 6f 73 66 73 63 6b 2f | 52 45 41 44 4d 45 00 00 |dosfsck/|README..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00000070| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00000080| 20 20 20 32 37 33 35 20 | 20 35 33 37 33 35 37 35 | 2735 | 5373575|
|00000090| 30 35 34 20 20 31 31 34 | 31 34 00 20 30 00 00 00 |054 114|14. 0...|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 64 6f 73 66 73 63 6b 2c | 20 76 65 72 73 69 6f 6e |dosfsck,| version|
|00000210| 20 31 0a 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d | 1.=====|========|
|00000220| 3d 3d 3d 3d 3d 0a 0a 57 | 41 52 4e 49 4e 47 3a 20 |=====..W|ARNING: |
|00000230| 54 68 69 73 20 69 73 20 | 41 4c 50 48 41 20 74 65 |This is |ALPHA te|
|00000240| 73 74 20 73 6f 66 74 77 | 61 72 65 2e 20 55 73 65 |st softw|are. Use|
|00000250| 20 61 74 20 79 6f 75 72 | 20 6f 77 6e 20 72 69 73 | at your| own ris|
|00000260| 6b 2e 0a 0a 64 6f 73 66 | 73 63 6b 20 69 73 20 74 |k...dosf|sck is t|
|00000270| 68 65 20 4c 69 6e 75 78 | 20 65 71 75 69 76 61 6c |he Linux| equival|
|00000280| 65 6e 74 20 6f 66 20 50 | 43 2f 4d 53 2d 44 4f 53 |ent of P|C/MS-DOS|
|00000290| 27 20 43 48 4b 44 53 4b | 2e 20 49 74 20 63 68 65 |' CHKDSK|. It che|
|000002a0| 63 6b 73 20 74 68 65 0a | 63 6f 6e 73 69 73 74 65 |cks the.|consiste|
|000002b0| 6e 63 79 20 6f 66 20 50 | 43 2f 4d 53 2d 44 4f 53 |ncy of P|C/MS-DOS|
|000002c0| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 73 20 61 6e | file sy|stems an|
|000002d0| 64 20 6f 70 74 69 6f 6e | 61 6c 6c 79 20 74 72 69 |d option|ally tri|
|000002e0| 65 73 20 74 6f 20 72 65 | 70 61 69 72 0a 74 68 65 |es to re|pair.the|
|000002f0| 6d 2e 20 54 68 65 20 74 | 65 73 74 73 20 64 6f 73 |m. The t|ests dos|
|00000300| 66 73 63 6b 20 70 65 72 | 66 6f 72 6d 73 20 61 72 |fsck per|forms ar|
|00000310| 65 20 64 65 73 63 72 69 | 62 65 64 20 69 6e 20 74 |e descri|bed in t|
|00000320| 68 65 20 6d 61 6e 20 70 | 61 67 65 2e 0a 0a 64 6f |he man p|age...do|
|00000330| 73 66 73 63 6b 20 6e 65 | 65 64 73 20 68 65 61 64 |sfsck ne|eds head|
|00000340| 65 72 20 66 69 6c 65 73 | 20 66 72 6f 6d 20 64 6f |er files| from do|
|00000350| 73 66 73 2e 39 20 28 6f | 72 20 6c 61 74 65 72 29 |sfs.9 (o|r later)|
|00000360| 20 74 6f 20 63 6f 6d 70 | 69 6c 65 2e 0a 0a 42 65 | to comp|ile...Be|
|00000370| 66 6f 72 65 20 75 73 69 | 6e 67 20 64 6f 73 66 73 |fore usi|ng dosfs|
|00000380| 63 6b 20 74 6f 20 72 65 | 70 61 69 72 20 61 20 66 |ck to re|pair a f|
|00000390| 69 6c 65 20 73 79 73 74 | 65 6d 20 74 68 61 74 20 |ile syst|em that |
|000003a0| 63 6f 6e 74 61 69 6e 73 | 20 64 61 74 61 20 6f 66 |contains| data of|
|000003b0| 20 61 6e 79 0a 76 61 6c | 75 65 2c 20 79 6f 75 20 | any.val|ue, you |
|000003c0| 73 68 6f 75 6c 64 20 76 | 65 72 69 66 79 20 74 68 |should v|erify th|
|000003d0| 61 74 20 64 6f 73 66 73 | 63 6b 20 69 73 20 61 62 |at dosfs|ck is ab|
|000003e0| 6c 65 20 74 6f 20 63 6f | 72 72 65 63 74 20 61 6c |le to co|rrect al|
|000003f0| 6c 20 72 65 70 6f 72 74 | 65 64 0a 65 72 72 6f 72 |l report|ed.error|
|00000400| 73 2e 20 28 45 78 63 65 | 70 74 20 66 61 74 61 6c |s. (Exce|pt fatal|
|00000410| 20 65 72 72 6f 72 73 20 | 61 6e 64 20 74 68 6f 73 | errors |and thos|
|00000420| 65 20 72 65 70 6f 72 74 | 65 64 20 61 73 20 75 6e |e report|ed as un|
|00000430| 66 69 78 61 62 6c 65 2c | 20 6f 66 0a 63 6f 75 72 |fixable,| of.cour|
|00000440| 73 65 2e 29 20 49 6e 20 | 6f 72 64 65 72 20 74 6f |se.) In |order to|
|00000450| 20 64 6f 20 74 68 69 73 | 2c 20 72 75 6e 20 69 74 | do this|, run it|
|00000460| 20 77 69 74 68 20 74 68 | 65 20 2d 56 20 6f 70 74 | with th|e -V opt|
|00000470| 69 6f 6e 2c 20 65 2e 67 | 2e 0a 0a 20 20 20 64 6f |ion, e.g|... do|
|00000480| 73 66 73 63 6b 20 2d 56 | 20 2f 64 65 76 2f 73 64 |sfsck -V| /dev/sd|
|00000490| 61 31 09 09 28 61 75 74 | 6f 6d 61 74 69 63 20 63 |a1..(aut|omatic c|
|000004a0| 68 65 63 6b 29 0a 6f 72 | 20 64 6f 73 66 73 63 6b |heck).or| dosfsck|
|000004b0| 20 2d 56 20 2d 72 20 2f | 64 65 76 2f 73 64 61 31 | -V -r /|dev/sda1|
|000004c0| 09 28 69 6e 74 65 72 61 | 63 74 69 76 65 20 63 68 |.(intera|ctive ch|
|000004d0| 65 63 6b 20 61 6e 64 20 | 72 65 70 61 69 72 29 0a |eck and |repair).|
|000004e0| 0a 64 6f 73 66 73 63 6b | 20 77 69 6c 6c 20 70 65 |.dosfsck| will pe|
|000004f0| 72 66 6f 72 6d 20 74 77 | 6f 20 70 61 73 73 65 73 |rform tw|o passes|
|00000500| 3a 20 69 6e 20 74 68 65 | 20 66 69 72 73 74 20 70 |: in the| first p|
|00000510| 61 73 73 2c 20 69 6e 63 | 6f 6e 73 69 73 74 65 6e |ass, inc|onsisten|
|00000520| 63 69 65 73 20 61 72 65 | 0a 64 65 74 65 63 74 65 |cies are|.detecte|
|00000530| 64 20 61 6e 64 20 61 20 | 6c 69 73 74 20 6f 66 20 |d and a |list of |
|00000540| 63 68 61 6e 67 65 73 20 | 74 6f 20 63 6f 72 72 65 |changes |to corre|
|00000550| 63 74 20 74 68 65 20 70 | 72 6f 62 6c 65 6d 73 20 |ct the p|roblems |
|00000560| 69 73 20 67 65 6e 65 72 | 61 74 65 64 2e 20 49 6e |is gener|ated. In|
|00000570| 0a 74 68 65 20 73 65 63 | 6f 6e 64 20 70 61 73 73 |.the sec|ond pass|
|00000580| 2c 20 74 68 6f 73 65 20 | 63 68 61 6e 67 65 73 20 |, those |changes |
|00000590| 61 72 65 20 61 70 70 6c | 69 65 64 20 77 68 65 6e |are appl|ied when|
|000005a0| 65 76 65 72 20 64 6f 73 | 66 73 63 6b 20 72 65 61 |ever dos|fsck rea|
|000005b0| 64 73 20 64 61 74 61 0a | 66 72 6f 6d 20 64 69 73 |ds data.|from dis|
|000005c0| 6b 2e 20 48 65 6e 63 65 | 20 6e 6f 20 66 69 78 61 |k. Hence| no fixa|
|000005d0| 62 6c 65 20 65 72 72 6f | 72 73 20 73 68 6f 75 6c |ble erro|rs shoul|
|000005e0| 64 20 62 65 20 72 65 70 | 6f 72 74 65 64 20 69 6e |d be rep|orted in|
|000005f0| 20 74 68 65 20 73 65 63 | 6f 6e 64 0a 70 61 73 73 | the sec|ond.pass|
|00000600| 20 69 66 20 74 68 65 20 | 66 69 72 73 74 20 70 61 | if the |first pa|
|00000610| 73 73 20 77 61 73 20 73 | 75 63 63 65 73 73 66 75 |ss was s|uccessfu|
|00000620| 6c 2e 0a 0a 50 6c 65 61 | 73 65 20 6e 6f 74 69 66 |l...Plea|se notif|
|00000630| 79 20 74 68 65 20 61 75 | 74 68 6f 72 20 69 66 20 |y the au|thor if |
|00000640| 66 69 78 61 62 6c 65 20 | 65 72 72 6f 72 73 20 61 |fixable |errors a|
|00000650| 72 65 20 72 65 70 6f 72 | 74 65 64 20 69 6e 20 74 |re repor|ted in t|
|00000660| 68 65 20 73 65 63 6f 6e | 64 0a 70 61 73 73 2e 0a |he secon|d.pass..|
|00000670| 0a 41 66 74 65 72 20 76 | 65 72 69 66 79 69 6e 67 |.After v|erifying|
|00000680| 20 74 68 61 74 20 64 6f | 73 66 73 63 6b 20 61 70 | that do|sfsck ap|
|00000690| 70 65 61 72 73 20 74 6f | 20 62 65 20 61 62 6c 65 |pears to| be able|
|000006a0| 20 74 6f 20 70 65 72 66 | 6f 72 6d 20 74 68 65 20 | to perf|orm the |
|000006b0| 64 65 73 69 72 65 64 0a | 6f 70 65 72 61 74 69 6f |desired.|operatio|
|000006c0| 6e 73 2c 20 65 69 74 68 | 65 72 20 63 6f 6e 66 69 |ns, eith|er confi|
|000006d0| 72 6d 20 74 68 61 74 20 | 79 6f 75 20 77 61 6e 74 |rm that |you want|
|000006e0| 20 74 68 65 20 63 68 61 | 6e 67 65 73 20 74 6f 20 | the cha|nges to |
|000006f0| 62 65 20 70 65 72 66 6f | 72 6d 65 64 0a 28 69 66 |be perfo|rmed.(if|
|00000700| 20 64 6f 73 66 73 63 6b | 20 77 61 73 20 73 74 61 | dosfsck| was sta|
|00000710| 72 74 65 64 20 77 69 74 | 68 20 2d 72 29 20 6f 72 |rted wit|h -r) or|
|00000720| 20 72 65 2d 72 75 6e 20 | 64 6f 73 66 73 63 6b 20 | re-run |dosfsck |
|00000730| 77 69 74 68 20 74 68 65 | 20 2d 61 20 6f 70 74 69 |with the| -a opti|
|00000740| 6f 6e 0a 28 69 66 20 69 | 74 20 77 61 73 20 73 74 |on.(if i|t was st|
|00000750| 61 72 74 65 64 20 77 69 | 74 68 6f 75 74 20 2d 72 |arted wi|thout -r|
|00000760| 29 2e 0a 0a 50 6c 65 61 | 73 65 20 73 65 6e 64 20 |)...Plea|se send |
|00000770| 62 75 67 20 72 65 70 6f | 72 74 73 2c 20 63 6f 6d |bug repo|rts, com|
|00000780| 6d 65 6e 74 73 2c 20 66 | 6c 61 6d 65 73 2c 20 65 |ments, f|lames, e|
|00000790| 74 63 2e 20 74 6f 0a 61 | 6c 6d 65 73 62 65 72 40 |tc. to.a|lmesber@|
|000007a0| 6e 65 73 73 69 65 2e 63 | 73 2e 69 64 2e 65 74 68 |nessie.c|s.id.eth|
|000007b0| 7a 2e 63 68 20 20 6f 72 | 20 20 61 6c 6d 65 73 62 |z.ch or| almesb|
|000007c0| 65 72 40 62 65 72 6e 69 | 6e 61 2e 65 74 68 7a 2e |er@berni|na.ethz.|
|000007d0| 63 68 0a 0a 2d 20 57 65 | 72 6e 65 72 0a 00 00 00 |ch..- We|rner....|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000800| 64 6f 73 66 73 63 6b 2f | 43 48 41 4e 47 45 53 00 |dosfsck/|CHANGES.|
|00000810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00000870| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00000880| 20 20 20 20 36 33 35 20 | 20 35 33 37 33 35 37 35 | 635 | 5373575|
|00000890| 30 31 37 20 20 31 31 35 | 30 33 00 20 30 00 00 00 |017 115|03. 0...|
|000008a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000900| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00000910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000920| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a00| 43 68 61 6e 67 65 73 20 | 66 72 6f 6d 20 76 65 72 |Changes |from ver|
|00000a10| 73 69 6f 6e 20 30 20 74 | 6f 20 31 0a 3d 3d 3d 3d |sion 0 t|o 1.====|
|00000a20| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000a30| 3d 3d 3d 3d 3d 3d 3d 0a | 0a 20 20 2d 20 66 69 78 |=======.|. - fix|
|00000a40| 65 64 20 61 6e 20 6f 66 | 66 2d 62 79 2d 74 77 6f |ed an of|f-by-two|
|00000a50| 20 65 72 72 6f 72 20 69 | 6e 20 63 68 65 63 6b 2e | error i|n check.|
|00000a60| 63 3a 63 68 65 63 6b 5f | 66 69 6c 65 0a 20 20 2d |c:check_|file. -|
|00000a70| 20 66 69 78 65 64 20 6d | 61 72 6b 69 6e 67 20 63 | fixed m|arking c|
|00000a80| 6c 75 73 74 65 72 73 20 | 62 61 64 20 69 6e 20 66 |lusters |bad in f|
|00000a90| 61 74 2e 63 3a 73 65 74 | 5f 66 61 74 0a 20 20 2d |at.c:set|_fat. -|
|00000aa0| 20 66 61 74 2e 63 3a 72 | 65 63 6c 61 69 6d 5f 66 | fat.c:r|eclaim_f|
|00000ab0| 72 65 65 20 77 61 73 20 | 61 6c 73 6f 20 72 65 63 |ree was |also rec|
|00000ac0| 6c 61 69 6d 69 6e 67 20 | 62 61 64 20 63 6c 75 73 |laiming |bad clus|
|00000ad0| 74 65 72 73 2e 0a 20 20 | 2d 20 66 69 78 65 64 20 |ters.. |- fixed |
|00000ae0| 6d 61 6e 79 20 69 6e 63 | 6f 72 72 65 63 74 20 62 |many inc|orrect b|
|00000af0| 79 74 65 20 73 65 78 20 | 63 6f 6e 76 65 72 73 69 |yte sex |conversi|
|00000b00| 6f 6e 73 20 69 6e 20 63 | 68 65 63 6b 2e 63 20 61 |ons in c|heck.c a|
|00000b10| 6e 64 20 66 61 74 2e 63 | 0a 20 20 2d 20 2d 74 20 |nd fat.c|. - -t |
|00000b20| 61 6e 64 20 2d 77 20 6e | 6f 77 20 72 65 71 75 69 |and -w n|ow requi|
|00000b30| 72 65 20 2d 61 20 6f 72 | 20 2d 72 0a 20 20 2d 20 |re -a or| -r. - |
|00000b40| 61 64 64 65 64 20 6f 70 | 74 69 6f 6e 20 2d 64 20 |added op|tion -d |
|00000b50| 74 6f 20 64 72 6f 70 20 | 66 69 6c 65 73 2e 0a 20 |to drop |files.. |
|00000b60| 20 2d 20 61 64 64 65 64 | 20 6f 70 74 69 6f 6e 20 | - added| option |
|00000b70| 2d 75 20 74 6f 20 74 72 | 79 20 74 6f 20 22 75 6e |-u to tr|y to "un|
|00000b80| 64 65 6c 65 74 65 22 20 | 6e 6f 6e 2d 64 69 72 65 |delete" |non-dire|
|00000b90| 63 74 6f 72 79 20 66 69 | 6c 65 73 2e 0a 00 00 00 |ctory fi|les.....|
|00000ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c00| 64 6f 73 66 73 63 6b 2f | 4d 61 6b 65 66 69 6c 65 |dosfsck/|Makefile|
|00000c10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00000c70| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00000c80| 20 20 20 31 33 33 30 20 | 20 35 33 37 33 33 32 33 | 1330 | 5373323|
|00000c90| 31 35 36 20 20 31 32 31 | 35 34 00 20 30 00 00 00 |156 121|54. 0...|
|00000ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d00| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00000d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d20| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00000d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 43 43 3d 63 63 0a 43 50 | 50 3d 24 28 43 43 29 20 |CC=cc.CP|P=$(CC) |
|00000e10| 2d 45 0a 43 46 4c 41 47 | 53 3d 2d 57 61 6c 6c 20 |-E.CFLAG|S=-Wall |
|00000e20| 2d 57 6e 6f 2d 70 61 72 | 65 6e 74 68 65 73 65 73 |-Wno-par|entheses|
|00000e30| 20 2d 67 0a 4c 44 46 4c | 41 47 53 3d 0a 4f 42 4a | -g.LDFL|AGS=.OBJ|
|00000e40| 53 3d 62 6f 6f 74 2e 6f | 20 63 68 65 63 6b 2e 6f |S=boot.o| check.o|
|00000e50| 20 63 6f 6d 6d 6f 6e 2e | 6f 20 64 6f 73 66 73 63 | common.|o dosfsc|
|00000e60| 6b 2e 6f 20 66 61 74 2e | 6f 20 66 69 6c 65 2e 6f |k.o fat.|o file.o|
|00000e70| 20 69 6f 2e 6f 0a 0a 64 | 6f 73 66 73 63 6b 3a 09 | io.o..d|osfsck:.|
|00000e80| 24 28 4f 42 4a 53 29 0a | 09 09 24 28 43 43 29 20 |$(OBJS).|..$(CC) |
|00000e90| 2d 6f 20 64 6f 73 66 73 | 63 6b 20 24 28 4c 44 46 |-o dosfs|ck $(LDF|
|00000ea0| 4c 41 47 53 29 20 24 28 | 4f 42 4a 53 29 0a 0a 2e |LAGS) $(|OBJS)...|
|00000eb0| 63 2e 6f 3a 0a 09 09 24 | 28 43 43 29 20 2d 63 20 |c.o:...$|(CC) -c |
|00000ec0| 24 28 43 46 4c 41 47 53 | 29 20 24 2a 2e 63 0a 0a |$(CFLAGS|) $*.c..|
|00000ed0| 63 6c 65 61 6e 3a 0a 09 | 09 72 6d 20 2d 66 20 2a |clean:..|.rm -f *|
|00000ee0| 2e 6f 20 74 6d 70 5f 6d | 61 6b 65 0a 0a 73 70 6f |.o tmp_m|ake..spo|
|00000ef0| 74 6c 65 73 73 3a 09 63 | 6c 65 61 6e 0a 09 09 72 |tless:.c|lean...r|
|00000f00| 6d 20 2d 66 20 64 6f 73 | 66 73 63 6b 0a 0a 64 65 |m -f dos|fsck..de|
|00000f10| 70 3a 0a 09 09 73 65 64 | 20 27 2f 5c 23 5c 23 5c |p:...sed| '/\#\#\|
|00000f20| 23 20 44 65 70 65 6e 64 | 65 6e 63 69 65 73 2f 71 |# Depend|encies/q|
|00000f30| 27 20 3c 4d 61 6b 65 66 | 69 6c 65 20 3e 74 6d 70 |' <Makef|ile >tmp|
|00000f40| 5f 6d 61 6b 65 0a 09 09 | 24 28 43 50 50 29 20 24 |_make...|$(CPP) $|
|00000f50| 28 43 46 4c 41 47 53 29 | 20 2d 4d 4d 20 2a 2e 63 |(CFLAGS)| -MM *.c|
|00000f60| 20 3e 3e 74 6d 70 5f 6d | 61 6b 65 0a 09 09 6d 76 | >>tmp_m|ake...mv|
|00000f70| 20 74 6d 70 5f 6d 61 6b | 65 20 4d 61 6b 65 66 69 | tmp_mak|e Makefi|
|00000f80| 6c 65 0a 0a 23 23 23 20 | 44 65 70 65 6e 64 65 6e |le..### |Dependen|
|00000f90| 63 69 65 73 0a 62 6f 6f | 74 2e 6f 20 3a 20 62 6f |cies.boo|t.o : bo|
|00000fa0| 6f 74 2e 63 20 63 6f 6d | 6d 6f 6e 2e 68 20 64 6f |ot.c com|mon.h do|
|00000fb0| 73 66 73 63 6b 2e 68 20 | 69 6f 2e 68 20 62 6f 6f |sfsck.h |io.h boo|
|00000fc0| 74 2e 68 20 0a 63 68 65 | 63 6b 2e 6f 20 3a 20 63 |t.h .che|ck.o : c|
|00000fd0| 68 65 63 6b 2e 63 20 63 | 6f 6d 6d 6f 6e 2e 68 20 |heck.c c|ommon.h |
|00000fe0| 64 6f 73 66 73 63 6b 2e | 68 20 69 6f 2e 68 20 66 |dosfsck.|h io.h f|
|00000ff0| 61 74 2e 68 20 66 69 6c | 65 2e 68 20 63 68 65 63 |at.h fil|e.h chec|
|00001000| 6b 2e 68 20 0a 63 6f 6d | 6d 6f 6e 2e 6f 20 3a 20 |k.h .com|mon.o : |
|00001010| 63 6f 6d 6d 6f 6e 2e 63 | 20 63 6f 6d 6d 6f 6e 2e |common.c| common.|
|00001020| 68 20 0a 64 6f 73 66 73 | 63 6b 2e 6f 20 3a 20 64 |h .dosfs|ck.o : d|
|00001030| 6f 73 66 73 63 6b 2e 63 | 20 63 6f 6d 6d 6f 6e 2e |osfsck.c| common.|
|00001040| 68 20 64 6f 73 66 73 63 | 6b 2e 68 20 69 6f 2e 68 |h dosfsc|k.h io.h|
|00001050| 20 62 6f 6f 74 2e 68 20 | 66 61 74 2e 68 20 66 69 | boot.h |fat.h fi|
|00001060| 6c 65 2e 68 20 63 68 65 | 63 6b 2e 68 20 0a 66 61 |le.h che|ck.h .fa|
|00001070| 74 2e 6f 20 3a 20 66 61 | 74 2e 63 20 63 6f 6d 6d |t.o : fa|t.c comm|
|00001080| 6f 6e 2e 68 20 64 6f 73 | 66 73 63 6b 2e 68 20 69 |on.h dos|fsck.h i|
|00001090| 6f 2e 68 20 66 61 74 2e | 68 20 0a 66 69 6c 65 2e |o.h fat.|h .file.|
|000010a0| 6f 20 3a 20 66 69 6c 65 | 2e 63 20 66 69 6c 65 2e |o : file|.c file.|
|000010b0| 68 20 0a 69 6f 2e 6f 20 | 3a 20 69 6f 2e 63 20 64 |h .io.o |: io.c d|
|000010c0| 6f 73 66 73 63 6b 2e 68 | 20 63 6f 6d 6d 6f 6e 2e |osfsck.h| common.|
|000010d0| 68 20 69 6f 2e 68 20 0a | 00 00 00 00 00 00 00 00 |h io.h .|........|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001200| 64 6f 73 66 73 63 6b 2f | 64 6f 73 66 73 63 6b 2e |dosfsck/|dosfsck.|
|00001210| 38 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |8.......|........|
|00001220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00001270| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00001280| 20 20 31 30 32 30 30 20 | 20 35 33 37 33 35 37 34 | 10200 | 5373574|
|00001290| 30 32 33 20 20 31 32 32 | 35 36 00 20 30 00 00 00 |023 122|56. 0...|
|000012a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001300| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00001310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001320| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00001330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001400| 2e 54 48 20 44 4f 53 46 | 53 43 4b 20 38 20 22 4d |.TH DOSF|SCK 8 "M|
|00001410| 61 79 20 31 31 20 31 39 | 39 33 22 20 22 4c 69 6e |ay 11 19|93" "Lin|
|00001420| 75 78 22 20 22 4d 41 49 | 4e 54 45 4e 41 4e 43 45 |ux" "MAI|NTENANCE|
|00001430| 20 43 4f 4d 4d 41 4e 44 | 53 22 0a 2e 53 48 20 4e | COMMAND|S"..SH N|
|00001440| 41 4d 45 0a 64 6f 73 66 | 73 63 6b 20 5c 2d 20 63 |AME.dosf|sck \- c|
|00001450| 68 65 63 6b 20 61 6e 64 | 20 72 65 70 61 69 72 20 |heck and| repair |
|00001460| 4d 53 2d 44 4f 53 20 66 | 69 6c 65 20 73 79 73 74 |MS-DOS f|ile syst|
|00001470| 65 6d 73 0a 2e 53 48 20 | 53 59 4e 4f 50 53 49 53 |ems..SH |SYNOPSIS|
|00001480| 0a 2e 61 64 20 6c 0a 2e | 42 20 64 6f 73 66 73 63 |..ad l..|B dosfsc|
|00001490| 6b 0a 2e 52 42 20 5b 20 | 5c 2d 61 66 6c 72 74 76 |k..RB [ |\-aflrtv|
|000014a0| 56 77 20 5d 0a 2e 52 42 | 20 5b 20 5c 2d 64 20 5c |Vw ]..RB| [ \-d \|
|000014b0| 66 49 70 61 74 68 5c 66 | 42 20 5c 2d 64 20 5c 66 |fIpath\f|B \-d \f|
|000014c0| 49 2e 2e 2e 5c 66 42 20 | 5d 0a 2e 52 42 20 5b 20 |I...\fB |]..RB [ |
|000014d0| 5c 2d 75 20 5c 66 49 70 | 61 74 68 5c 66 42 20 5c |\-u \fIp|ath\fB \|
|000014e0| 2d 75 20 5c 66 49 2e 2e | 2e 5c 66 42 20 5d 0a 2e |-u \fI..|.\fB ]..|
|000014f0| 49 20 64 65 76 69 63 65 | 0a 2e 61 64 20 62 0a 2e |I device|..ad b..|
|00001500| 53 48 20 44 45 53 43 52 | 49 50 54 49 4f 4e 0a 2e |SH DESCR|IPTION..|
|00001510| 42 20 64 6f 73 66 73 63 | 6b 0a 76 65 72 69 66 69 |B dosfsc|k.verifi|
|00001520| 65 73 20 74 68 65 20 63 | 6f 6e 73 69 73 74 65 6e |es the c|onsisten|
|00001530| 63 79 20 6f 66 20 4d 53 | 2d 44 4f 53 20 66 69 6c |cy of MS|-DOS fil|
|00001540| 65 20 73 79 73 74 65 6d | 73 20 61 6e 64 20 6f 70 |e system|s and op|
|00001550| 74 69 6f 6e 61 6c 6c 79 | 20 74 72 69 65 73 20 74 |tionally| tries t|
|00001560| 6f 0a 72 65 70 61 69 72 | 20 74 68 65 6d 2e 20 54 |o.repair| them. T|
|00001570| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 66 69 6c |he follo|wing fil|
|00001580| 65 20 73 79 73 74 65 6d | 20 70 72 6f 62 6c 65 6d |e system| problem|
|00001590| 73 20 63 61 6e 20 62 65 | 20 63 6f 72 72 65 63 74 |s can be| correct|
|000015a0| 65 64 20 28 69 6e 20 74 | 68 69 73 0a 6f 72 64 65 |ed (in t|his.orde|
|000015b0| 72 29 3a 0a 2e 49 50 20 | 5c 2d 0a 46 41 54 20 63 |r):..IP |\-.FAT c|
|000015c0| 6f 6e 74 61 69 6e 73 20 | 69 6e 76 61 6c 69 64 20 |ontains |invalid |
|000015d0| 63 6c 75 73 74 65 72 20 | 6e 75 6d 62 65 72 73 2e |cluster |numbers.|
|000015e0| 20 43 6c 75 73 74 65 72 | 20 69 73 20 63 68 61 6e | Cluster| is chan|
|000015f0| 67 65 64 20 74 6f 20 45 | 4f 46 2e 0a 2e 50 44 20 |ged to E|OF...PD |
|00001600| 30 0a 2e 49 50 20 5c 2d | 0a 46 69 6c 65 27 73 20 |0..IP \-|.File's |
|00001610| 63 6c 75 73 74 65 72 20 | 63 68 61 69 6e 20 63 6f |cluster |chain co|
|00001620| 6e 74 61 69 6e 73 20 61 | 20 6c 6f 6f 70 2e 20 54 |ntains a| loop. T|
|00001630| 68 65 20 6c 6f 6f 70 20 | 69 73 20 62 72 6f 6b 65 |he loop |is broke|
|00001640| 6e 2e 0a 2e 49 50 20 5c | 2d 0a 42 61 64 20 63 6c |n...IP \|-.Bad cl|
|00001650| 75 73 74 65 72 73 20 28 | 72 65 61 64 20 65 72 72 |usters (|read err|
|00001660| 6f 72 73 29 2e 20 54 68 | 65 20 63 6c 75 73 74 65 |ors). Th|e cluste|
|00001670| 72 73 20 61 72 65 20 6d | 61 72 6b 65 64 20 62 61 |rs are m|arked ba|
|00001680| 64 20 61 6e 64 20 74 68 | 65 79 20 61 72 65 0a 72 |d and th|ey are.r|
|00001690| 65 6d 6f 76 65 64 20 66 | 72 6f 6d 20 66 69 6c 65 |emoved f|rom file|
|000016a0| 73 20 6f 77 6e 69 6e 67 | 20 74 68 65 6d 2e 20 54 |s owning| them. T|
|000016b0| 68 69 73 20 63 68 65 63 | 6b 20 69 73 20 6f 70 74 |his chec|k is opt|
|000016c0| 69 6f 6e 61 6c 2e 0a 2e | 49 50 20 5c 2d 0a 44 69 |ional...|IP \-.Di|
|000016d0| 72 65 63 74 6f 72 69 65 | 73 20 77 69 74 68 20 61 |rectorie|s with a|
|000016e0| 20 6c 61 72 67 65 20 6e | 75 6d 62 65 72 20 6f 66 | large n|umber of|
|000016f0| 20 62 61 64 20 65 6e 74 | 72 69 65 73 20 28 70 72 | bad ent|ries (pr|
|00001700| 6f 62 61 62 6c 79 20 63 | 6f 72 72 75 70 74 29 2e |obably c|orrupt).|
|00001710| 20 54 68 65 0a 64 69 72 | 65 63 74 6f 72 79 20 63 | The.dir|ectory c|
|00001720| 61 6e 20 62 65 20 64 72 | 6f 70 70 65 64 2e 0a 2e |an be dr|opped...|
|00001730| 49 50 20 5c 2d 0a 46 69 | 6c 65 73 20 2e 20 61 6e |IP \-.Fi|les . an|
|00001740| 64 20 2e 2e 20 61 72 65 | 20 6e 6f 6e 2d 64 69 72 |d .. are| non-dir|
|00001750| 65 63 74 6f 72 69 65 73 | 2e 20 54 68 65 79 20 63 |ectories|. They c|
|00001760| 61 6e 20 62 65 20 64 72 | 6f 70 70 65 64 20 6f 72 |an be dr|opped or|
|00001770| 20 72 65 6e 61 6d 65 64 | 2e 0a 2e 49 50 20 5c 2d | renamed|...IP \-|
|00001780| 0a 44 69 72 65 63 74 6f | 72 69 65 73 20 2e 20 61 |.Directo|ries . a|
|00001790| 6e 64 20 2e 2e 20 69 6e | 20 72 6f 6f 74 20 64 69 |nd .. in| root di|
|000017a0| 72 65 63 74 6f 72 79 2e | 20 54 68 65 79 20 61 72 |rectory.| They ar|
|000017b0| 65 20 64 72 6f 70 70 65 | 64 2e 0a 2e 49 50 20 5c |e droppe|d...IP \|
|000017c0| 2d 0a 42 61 64 20 66 69 | 6c 65 20 6e 61 6d 65 73 |-.Bad fi|le names|
|000017d0| 2e 20 54 68 65 79 20 63 | 61 6e 20 62 65 20 72 65 |. They c|an be re|
|000017e0| 6e 61 6d 65 64 2e 0a 2e | 49 50 20 5c 2d 0a 44 75 |named...|IP \-.Du|
|000017f0| 70 6c 69 63 61 74 65 20 | 64 69 72 65 63 74 6f 72 |plicate |director|
|00001800| 79 20 65 6e 74 72 69 65 | 73 2e 20 54 68 65 79 20 |y entrie|s. They |
|00001810| 63 61 6e 20 62 65 20 64 | 72 6f 70 70 65 64 20 6f |can be d|ropped o|
|00001820| 72 20 72 65 6e 61 6d 65 | 64 2e 0a 2e 49 50 20 5c |r rename|d...IP \|
|00001830| 2d 0a 44 69 72 65 63 74 | 6f 72 69 65 73 20 77 69 |-.Direct|ories wi|
|00001840| 74 68 20 6e 6f 6e 2d 7a | 65 72 6f 20 73 69 7a 65 |th non-z|ero size|
|00001850| 20 66 69 65 6c 64 2e 20 | 53 69 7a 65 20 69 73 20 | field. |Size is |
|00001860| 73 65 74 20 74 6f 20 7a | 65 72 6f 2e 0a 2e 49 50 |set to z|ero...IP|
|00001870| 20 5c 2d 0a 44 69 72 65 | 63 74 6f 72 79 20 2e 20 | \-.Dire|ctory . |
|00001880| 64 6f 65 73 20 6e 6f 74 | 20 70 6f 69 6e 74 20 74 |does not| point t|
|00001890| 6f 20 70 61 72 65 6e 74 | 20 64 69 72 65 63 74 6f |o parent| directo|
|000018a0| 72 79 2e 20 54 68 65 20 | 73 74 61 72 74 20 70 6f |ry. The |start po|
|000018b0| 69 6e 74 65 72 20 69 73 | 0a 61 64 6a 75 73 74 65 |inter is|.adjuste|
|000018c0| 64 2e 0a 2e 49 50 20 5c | 2d 0a 44 69 72 65 63 74 |d...IP \|-.Direct|
|000018d0| 6f 72 79 20 2e 2e 20 64 | 6f 65 73 20 6e 6f 74 20 |ory .. d|oes not |
|000018e0| 70 6f 69 6e 74 20 74 6f | 20 70 61 72 65 6e 74 20 |point to| parent |
|000018f0| 6f 66 20 70 61 72 65 6e | 74 20 64 69 72 65 63 74 |of paren|t direct|
|00001900| 6f 72 79 2e 20 54 68 65 | 20 73 74 61 72 74 20 70 |ory. The| start p|
|00001910| 6f 69 6e 74 65 72 0a 69 | 73 20 61 64 6a 75 73 74 |ointer.i|s adjust|
|00001920| 65 64 2e 0a 2e 49 50 20 | 5c 2d 0a 53 74 61 72 74 |ed...IP |\-.Start|
|00001930| 20 63 6c 75 73 74 65 72 | 20 6e 75 6d 62 65 72 20 | cluster| number |
|00001940| 6f 66 20 61 20 66 69 6c | 65 20 69 73 20 69 6e 76 |of a fil|e is inv|
|00001950| 61 6c 69 64 2e 20 54 68 | 65 20 66 69 6c 65 20 69 |alid. Th|e file i|
|00001960| 73 20 74 72 75 6e 63 61 | 74 65 64 2e 0a 2e 49 50 |s trunca|ted...IP|
|00001970| 20 5c 2d 0a 46 69 6c 65 | 20 63 6f 6e 74 61 69 6e | \-.File| contain|
|00001980| 73 20 62 61 64 20 6f 72 | 20 66 72 65 65 20 63 6c |s bad or| free cl|
|00001990| 75 73 74 65 72 73 2e 20 | 54 68 65 20 66 69 6c 65 |usters. |The file|
|000019a0| 20 69 73 20 74 72 75 6e | 63 61 74 65 64 2e 0a 2e | is trun|cated...|
|000019b0| 49 50 20 5c 2d 0a 46 69 | 6c 65 27 73 20 63 6c 75 |IP \-.Fi|le's clu|
|000019c0| 73 74 65 72 20 63 68 61 | 69 6e 20 69 73 20 6c 6f |ster cha|in is lo|
|000019d0| 6e 67 65 72 20 74 68 61 | 6e 20 69 6e 64 69 63 61 |nger tha|n indica|
|000019e0| 74 65 64 20 62 79 20 74 | 68 65 20 73 69 7a 65 20 |ted by t|he size |
|000019f0| 66 69 65 6c 64 73 2e 20 | 54 68 65 20 66 69 6c 65 |fields. |The file|
|00001a00| 0a 69 73 20 74 72 75 6e | 63 61 74 65 64 2e 0a 2e |.is trun|cated...|
|00001a10| 49 50 20 5c 2d 0a 54 77 | 6f 20 6f 72 20 6d 6f 72 |IP \-.Tw|o or mor|
|00001a20| 65 20 66 69 6c 65 73 20 | 73 68 61 72 65 20 74 68 |e files |share th|
|00001a30| 65 20 73 61 6d 65 20 63 | 6c 75 73 74 65 72 28 73 |e same c|luster(s|
|00001a40| 29 2e 20 41 6c 6c 20 62 | 75 74 20 6f 6e 65 20 6f |). All b|ut one o|
|00001a50| 66 20 74 68 65 20 66 69 | 6c 65 73 20 61 72 65 0a |f the fi|les are.|
|00001a60| 74 72 75 6e 63 61 74 65 | 64 2e 20 49 66 20 74 68 |truncate|d. If th|
|00001a70| 65 20 66 69 6c 65 20 62 | 65 69 6e 67 20 74 72 75 |e file b|eing tru|
|00001a80| 6e 63 61 74 65 64 20 69 | 73 20 61 20 64 69 72 65 |ncated i|s a dire|
|00001a90| 63 74 6f 72 79 20 66 69 | 6c 65 20 74 68 61 74 20 |ctory fi|le that |
|00001aa0| 68 61 73 20 61 6c 72 65 | 61 64 79 0a 62 65 65 6e |has alre|ady.been|
|00001ab0| 20 72 65 61 64 2c 20 74 | 68 65 20 66 69 6c 65 20 | read, t|he file |
|00001ac0| 73 79 73 74 65 6d 20 63 | 68 65 63 6b 20 69 73 20 |system c|heck is |
|00001ad0| 72 65 73 74 61 72 74 65 | 64 20 61 66 74 65 72 20 |restarte|d after |
|00001ae0| 74 72 75 6e 63 61 74 69 | 6f 6e 2e 0a 2e 49 50 20 |truncati|on...IP |
|00001af0| 5c 2d 0a 46 69 6c 65 27 | 73 20 63 6c 75 73 74 65 |\-.File'|s cluste|
|00001b00| 72 20 63 68 61 69 6e 20 | 69 73 20 73 68 6f 72 74 |r chain |is short|
|00001b10| 65 72 20 74 68 61 6e 20 | 69 6e 64 69 63 61 74 65 |er than |indicate|
|00001b20| 64 20 62 79 20 74 68 65 | 20 73 69 7a 65 20 66 69 |d by the| size fi|
|00001b30| 65 6c 64 73 2e 20 54 68 | 65 20 66 69 6c 65 0a 69 |elds. Th|e file.i|
|00001b40| 73 20 74 72 75 6e 63 61 | 74 65 64 2e 0a 2e 49 50 |s trunca|ted...IP|
|00001b50| 20 5c 2d 0a 43 6c 75 73 | 74 65 72 73 20 61 72 65 | \-.Clus|ters are|
|00001b60| 20 6d 61 72 6b 65 64 20 | 61 73 20 75 73 65 64 20 | marked |as used |
|00001b70| 62 75 74 20 61 72 65 20 | 6e 6f 74 20 6f 77 6e 65 |but are |not owne|
|00001b80| 64 20 62 79 20 61 20 66 | 69 6c 65 2e 20 54 68 65 |d by a f|ile. The|
|00001b90| 79 20 61 72 65 20 6d 61 | 72 6b 65 64 0a 61 73 20 |y are ma|rked.as |
|00001ba0| 66 72 65 65 2e 0a 2e 50 | 44 0a 2e 4c 50 0a 41 64 |free...P|D..LP.Ad|
|00001bb0| 64 69 74 69 6f 6e 61 6c | 6c 79 2c 20 74 68 65 20 |ditional|ly, the |
|00001bc0| 66 6f 6c 6c 6f 77 69 6e | 67 20 70 72 6f 62 6c 65 |followin|g proble|
|00001bd0| 6d 73 20 61 72 65 20 64 | 65 74 65 63 74 65 64 2c |ms are d|etected,|
|00001be0| 20 62 75 74 20 6e 6f 74 | 20 72 65 70 61 69 72 65 | but not| repaire|
|00001bf0| 64 3a 0a 2e 49 50 20 5c | 2d 0a 49 6e 76 61 6c 69 |d:..IP \|-.Invali|
|00001c00| 64 20 70 61 72 61 6d 65 | 74 65 72 73 20 69 6e 20 |d parame|ters in |
|00001c10| 62 6f 6f 74 20 73 65 63 | 74 6f 72 2e 0a 2e 50 44 |boot sec|tor...PD|
|00001c20| 20 30 0a 2e 49 50 20 5c | 2d 0a 41 62 73 65 6e 63 | 0..IP \|-.Absenc|
|00001c30| 65 20 6f 66 20 2e 20 61 | 6e 64 20 2e 2e 20 65 6e |e of . a|nd .. en|
|00001c40| 74 72 69 65 73 20 69 6e | 20 6e 6f 6e 2d 72 6f 6f |tries in| non-roo|
|00001c50| 74 20 64 69 72 65 63 74 | 6f 72 69 65 73 0a 2e 50 |t direct|ories..P|
|00001c60| 44 0a 2e 4c 50 0a 57 68 | 65 6e 20 5c 66 42 64 6f |D..LP.Wh|en \fBdo|
|00001c70| 73 66 73 63 6b 5c 66 50 | 20 63 68 65 63 6b 73 20 |sfsck\fP| checks |
|00001c80| 61 20 66 69 6c 65 20 73 | 79 73 74 65 6d 2c 20 69 |a file s|ystem, i|
|00001c90| 74 20 61 63 63 75 6d 75 | 6c 61 74 65 73 20 61 6c |t accumu|lates al|
|00001ca0| 6c 20 63 68 61 6e 67 65 | 73 20 69 6e 20 6d 65 6d |l change|s in mem|
|00001cb0| 6f 72 79 0a 61 6e 64 20 | 70 65 72 66 6f 72 6d 73 |ory.and |performs|
|00001cc0| 20 74 68 65 6d 20 6f 6e | 6c 79 20 61 66 74 65 72 | them on|ly after|
|00001cd0| 20 61 6c 6c 20 63 68 65 | 63 6b 73 20 61 72 65 20 | all che|cks are |
|00001ce0| 63 6f 6d 70 6c 65 74 65 | 2e 20 54 68 69 73 20 63 |complete|. This c|
|00001cf0| 61 6e 20 62 65 20 64 69 | 73 61 62 6c 65 64 0a 77 |an be di|sabled.w|
|00001d00| 69 74 68 20 74 68 65 20 | 5c 66 42 5c 2d 77 5c 66 |ith the |\fB\-w\f|
|00001d10| 50 20 6f 70 74 69 6f 6e | 2e 0a 2e 53 48 20 4f 50 |P option|...SH OP|
|00001d20| 54 49 4f 4e 53 0a 2e 49 | 50 20 5c 66 42 5c 2d 61 |TIONS..I|P \fB\-a|
|00001d30| 5c 66 50 0a 41 75 74 6f | 6d 61 74 69 63 61 6c 6c |\fP.Auto|maticall|
|00001d40| 79 20 72 65 70 61 69 72 | 20 74 68 65 20 66 69 6c |y repair| the fil|
|00001d50| 65 20 73 79 73 74 65 6d | 2e 20 4e 6f 20 75 73 65 |e system|. No use|
|00001d60| 72 20 69 6e 74 65 72 76 | 65 6e 74 69 6f 6e 20 69 |r interv|ention i|
|00001d70| 73 20 6e 65 63 65 73 73 | 61 72 79 2e 0a 57 68 65 |s necess|ary..Whe|
|00001d80| 6e 65 76 65 72 20 74 68 | 65 72 65 20 69 73 20 6d |never th|ere is m|
|00001d90| 6f 72 65 20 74 68 61 6e | 20 6f 6e 65 20 6d 65 74 |ore than| one met|
|00001da0| 68 6f 64 20 74 6f 20 73 | 6f 6c 76 65 20 61 20 70 |hod to s|olve a p|
|00001db0| 72 6f 62 6c 65 6d 2c 20 | 74 68 65 20 6c 65 61 73 |roblem, |the leas|
|00001dc0| 74 0a 64 65 73 74 72 75 | 63 74 69 76 65 20 61 70 |t.destru|ctive ap|
|00001dd0| 70 72 6f 61 63 68 20 69 | 73 20 75 73 65 64 2e 0a |proach i|s used..|
|00001de0| 2e 49 50 20 5c 66 42 5c | 2d 64 5c 66 50 0a 44 72 |.IP \fB\|-d\fP.Dr|
|00001df0| 6f 70 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |op the s|pecified|
|00001e00| 20 66 69 6c 65 2e 20 49 | 66 20 6d 6f 72 65 20 74 | file. I|f more t|
|00001e10| 68 61 74 20 6f 6e 65 20 | 66 69 6c 65 20 77 69 74 |hat one |file wit|
|00001e20| 68 20 74 68 61 74 20 6e | 61 6d 65 20 65 78 69 73 |h that n|ame exis|
|00001e30| 74 73 2c 20 74 68 65 0a | 66 69 72 73 74 20 6f 6e |ts, the.|first on|
|00001e40| 65 20 69 73 20 64 72 6f | 70 70 65 64 2e 0a 2e 49 |e is dro|pped...I|
|00001e50| 50 20 5c 66 42 5c 2d 66 | 5c 66 50 0a 53 61 6c 76 |P \fB\-f|\fP.Salv|
|00001e60| 61 67 65 20 75 6e 75 73 | 65 64 20 63 6c 75 73 74 |age unus|ed clust|
|00001e70| 65 72 20 63 68 61 69 6e | 73 20 74 6f 20 66 69 6c |er chain|s to fil|
|00001e80| 65 73 2e 20 42 79 20 64 | 65 66 61 75 6c 74 2c 20 |es. By d|efault, |
|00001e90| 75 6e 75 73 65 64 20 63 | 6c 75 73 74 65 72 73 20 |unused c|lusters |
|00001ea0| 61 72 65 0a 61 64 64 65 | 64 20 74 6f 20 74 68 65 |are.adde|d to the|
|00001eb0| 20 66 72 65 65 20 64 69 | 73 6b 20 73 70 61 63 65 | free di|sk space|
|00001ec0| 2e 0a 2e 49 50 20 5c 66 | 42 5c 2d 6c 5c 66 50 0a |...IP \f|B\-l\fP.|
|00001ed0| 4c 69 73 74 20 70 61 74 | 68 20 6e 61 6d 65 73 20 |List pat|h names |
|00001ee0| 6f 66 20 66 69 6c 65 73 | 20 62 65 69 6e 67 20 70 |of files| being p|
|00001ef0| 72 6f 63 65 73 73 65 64 | 2e 0a 2e 49 50 20 5c 66 |rocessed|...IP \f|
|00001f00| 42 5c 2d 72 5c 66 50 0a | 49 6e 74 65 72 61 63 74 |B\-r\fP.|Interact|
|00001f10| 69 76 65 6c 79 20 72 65 | 70 61 69 72 20 74 68 65 |ively re|pair the|
|00001f20| 20 66 69 6c 65 20 73 79 | 73 74 65 6d 2e 20 54 68 | file sy|stem. Th|
|00001f30| 65 20 75 73 65 72 20 69 | 73 20 61 73 6b 65 64 20 |e user i|s asked |
|00001f40| 66 6f 72 20 61 64 76 69 | 63 65 20 77 68 65 6e 65 |for advi|ce whene|
|00001f50| 76 65 72 0a 74 68 65 72 | 65 20 69 73 20 6d 6f 72 |ver.ther|e is mor|
|00001f60| 65 20 74 68 61 6e 20 6f | 6e 65 20 61 70 70 72 6f |e than o|ne appro|
|00001f70| 61 63 68 20 74 6f 20 66 | 69 78 20 61 6e 20 69 6e |ach to f|ix an in|
|00001f80| 63 6f 6e 73 69 73 74 65 | 6e 63 79 2e 0a 2e 49 50 |consiste|ncy...IP|
|00001f90| 20 5c 66 42 5c 2d 74 5c | 66 50 0a 4d 61 72 6b 20 | \fB\-t\|fP.Mark |
|00001fa0| 75 6e 72 65 61 64 61 62 | 6c 65 20 63 6c 75 73 74 |unreadab|le clust|
|00001fb0| 65 72 73 20 61 73 20 62 | 61 64 2e 0a 2e 49 50 20 |ers as b|ad...IP |
|00001fc0| 5c 66 42 2d 75 5c 66 50 | 0a 54 72 79 20 74 6f 20 |\fB-u\fP|.Try to |
|00001fd0| 75 6e 64 65 6c 65 74 65 | 20 74 68 65 20 73 70 65 |undelete| the spe|
|00001fe0| 63 69 66 69 65 64 20 66 | 69 6c 65 2e 20 5c 66 42 |cified f|ile. \fB|
|00001ff0| 64 6f 73 66 73 63 6b 5c | 66 50 20 74 72 69 65 73 |dosfsck\|fP tries|
|00002000| 20 74 6f 20 61 6c 6c 6f | 63 61 74 65 20 61 20 63 | to allo|cate a c|
|00002010| 68 61 69 6e 0a 6f 66 20 | 63 6f 6e 74 69 67 75 6f |hain.of |contiguo|
|00002020| 75 73 20 75 6e 61 6c 6c | 6f 63 61 74 65 64 20 63 |us unall|ocated c|
|00002030| 6c 75 73 74 65 72 73 20 | 62 65 67 69 6e 6e 69 6e |lusters |beginnin|
|00002040| 67 20 77 69 74 68 20 74 | 68 65 20 73 74 61 72 74 |g with t|he start|
|00002050| 20 63 6c 75 73 74 65 72 | 20 6f 66 20 74 68 65 0a | cluster| of the.|
|00002060| 75 6e 64 65 6c 65 74 65 | 64 20 66 69 6c 65 2e 0a |undelete|d file..|
|00002070| 2e 49 50 20 5c 66 42 5c | 2d 76 5c 66 50 0a 56 65 |.IP \fB\|-v\fP.Ve|
|00002080| 72 62 6f 73 65 20 6d 6f | 64 65 2e 20 47 65 6e 65 |rbose mo|de. Gene|
|00002090| 72 61 74 65 73 20 73 6c | 69 67 68 74 6c 79 20 6d |rates sl|ightly m|
|000020a0| 6f 72 65 20 6f 75 74 70 | 75 74 2e 0a 2e 49 50 20 |ore outp|ut...IP |
|000020b0| 5c 66 42 5c 2d 56 5c 66 | 50 0a 50 65 72 66 6f 72 |\fB\-V\f|P.Perfor|
|000020c0| 6d 20 61 20 76 65 72 69 | 66 69 63 61 74 69 6f 6e |m a veri|fication|
|000020d0| 20 70 61 73 73 2e 20 54 | 68 65 20 66 69 6c 65 20 | pass. T|he file |
|000020e0| 73 79 73 74 65 6d 20 63 | 68 65 63 6b 20 69 73 20 |system c|heck is |
|000020f0| 72 65 70 65 61 74 65 64 | 20 61 66 74 65 72 20 74 |repeated| after t|
|00002100| 68 65 0a 66 69 72 73 74 | 20 72 75 6e 2e 20 54 68 |he.first| run. Th|
|00002110| 65 20 73 65 63 6f 6e 64 | 20 70 61 73 73 20 73 68 |e second| pass sh|
|00002120| 6f 75 6c 64 20 6e 65 76 | 65 72 20 72 65 70 6f 72 |ould nev|er repor|
|00002130| 74 20 61 6e 79 20 66 69 | 78 61 62 6c 65 20 65 72 |t any fi|xable er|
|00002140| 72 6f 72 73 2e 20 49 74 | 20 6d 61 79 0a 74 61 6b |rors. It| may.tak|
|00002150| 65 20 63 6f 6e 73 69 64 | 65 72 61 62 6c 79 20 6c |e consid|erably l|
|00002160| 6f 6e 67 65 72 20 74 68 | 61 6e 20 74 68 65 20 66 |onger th|an the f|
|00002170| 69 72 73 74 20 70 61 73 | 73 2c 20 62 65 63 61 75 |irst pas|s, becau|
|00002180| 73 65 20 74 68 65 20 66 | 69 72 73 74 20 70 61 73 |se the f|irst pas|
|00002190| 73 20 6d 61 79 0a 68 61 | 76 65 20 67 65 6e 65 72 |s may.ha|ve gener|
|000021a0| 61 74 65 64 20 6c 6f 6e | 67 20 6c 69 73 74 20 6f |ated lon|g list o|
|000021b0| 66 20 6d 6f 64 69 66 69 | 63 61 74 69 6f 6e 73 20 |f modifi|cations |
|000021c0| 74 68 61 74 20 68 61 76 | 65 20 74 6f 20 62 65 20 |that hav|e to be |
|000021d0| 73 63 61 6e 6e 65 64 20 | 66 6f 72 20 65 61 63 68 |scanned |for each|
|000021e0| 0a 64 69 73 6b 20 72 65 | 61 64 2e 0a 2e 49 50 20 |.disk re|ad...IP |
|000021f0| 5c 66 42 5c 2d 77 5c 66 | 50 0a 57 72 69 74 65 20 |\fB\-w\f|P.Write |
|00002200| 63 68 61 6e 67 65 73 20 | 74 6f 20 64 69 73 6b 20 |changes |to disk |
|00002210| 69 6d 6d 65 64 69 61 74 | 65 6c 79 2e 0a 2e 4c 50 |immediat|ely...LP|
|00002220| 0a 49 66 20 5c 66 42 5c | 2d 61 5c 66 50 20 61 6e |.If \fB\|-a\fP an|
|00002230| 64 20 5c 66 42 5c 2d 72 | 5c 66 50 20 61 72 65 20 |d \fB\-r|\fP are |
|00002240| 61 62 73 65 6e 74 2c 20 | 74 68 65 20 66 69 6c 65 |absent, |the file|
|00002250| 20 73 79 73 74 65 6d 20 | 69 73 20 6f 6e 6c 79 20 | system |is only |
|00002260| 63 68 65 63 6b 65 64 2c | 0a 62 75 74 20 6e 6f 74 |checked,|.but not|
|00002270| 20 72 65 70 61 69 72 65 | 64 2e 0a 2e 53 48 20 22 | repaire|d...SH "|
|00002280| 45 58 49 54 20 53 54 41 | 54 55 53 22 0a 2e 49 50 |EXIT STA|TUS"..IP|
|00002290| 20 30 0a 4e 6f 20 72 65 | 63 6f 76 65 72 61 62 6c | 0.No re|coverabl|
|000022a0| 65 20 65 72 72 6f 72 73 | 20 68 61 76 65 20 62 65 |e errors| have be|
|000022b0| 65 6e 20 64 65 74 65 63 | 74 65 64 2e 0a 2e 49 50 |en detec|ted...IP|
|000022c0| 20 31 0a 52 65 63 6f 76 | 65 72 61 62 6c 65 20 65 | 1.Recov|erable e|
|000022d0| 72 72 6f 72 73 20 68 61 | 76 65 20 62 65 65 6e 20 |rrors ha|ve been |
|000022e0| 64 65 74 65 63 74 65 64 | 20 6f 72 20 5c 66 42 64 |detected| or \fBd|
|000022f0| 6f 73 66 73 63 6b 5c 66 | 50 20 68 61 73 20 64 69 |osfsck\f|P has di|
|00002300| 73 63 6f 76 65 72 65 64 | 20 61 6e 0a 69 6e 74 65 |scovered| an.inte|
|00002310| 72 6e 61 6c 20 69 6e 63 | 6f 6e 73 69 73 74 65 6e |rnal inc|onsisten|
|00002320| 63 79 2e 0a 2e 49 50 20 | 32 0a 55 73 61 67 65 20 |cy...IP |2.Usage |
|00002330| 65 72 72 6f 72 2e 20 5c | 66 42 64 6f 73 66 73 63 |error. \|fBdosfsc|
|00002340| 6b 5c 66 50 20 64 69 64 | 20 6e 6f 74 20 61 63 63 |k\fP did| not acc|
|00002350| 65 73 73 20 74 68 65 20 | 66 69 6c 65 20 73 79 73 |ess the |file sys|
|00002360| 74 65 6d 2e 0a 2e 53 48 | 20 42 55 47 53 0a 44 6f |tem...SH| BUGS.Do|
|00002370| 65 73 20 6e 6f 74 20 63 | 72 65 61 74 65 20 2e 20 |es not c|reate . |
|00002380| 61 6e 64 20 2e 2e 20 66 | 69 6c 65 73 20 77 68 65 |and .. f|iles whe|
|00002390| 72 65 20 6e 65 63 65 73 | 73 61 72 79 2e 20 44 6f |re neces|sary. Do|
|000023a0| 65 73 20 6e 6f 74 20 72 | 65 6d 6f 76 65 20 65 6e |es not r|emove en|
|000023b0| 74 69 72 65 6c 79 0a 65 | 6d 70 74 79 20 64 69 72 |tirely.e|mpty dir|
|000023c0| 65 63 74 6f 72 69 65 73 | 2e 20 53 68 6f 75 6c 64 |ectories|. Should|
|000023d0| 20 67 69 76 65 20 6d 6f | 72 65 20 64 69 61 67 6e | give mo|re diagn|
|000023e0| 6f 73 74 69 63 20 6d 65 | 73 73 61 67 65 73 2e 20 |ostic me|ssages. |
|000023f0| 55 6e 64 65 6c 65 74 69 | 6e 67 20 66 69 6c 65 73 |Undeleti|ng files|
|00002400| 0a 73 68 6f 75 6c 64 20 | 75 73 65 20 61 20 6d 6f |.should |use a mo|
|00002410| 72 65 20 73 6f 70 68 69 | 73 74 69 63 61 74 65 64 |re sophi|sticated|
|00002420| 20 61 6c 67 6f 72 69 74 | 68 6d 2e 0a 2e 5c 22 2e | algorit|hm...\".|
|00002430| 53 48 20 22 53 45 45 20 | 41 4c 53 4f 22 0a 2e 5c |SH "SEE |ALSO"..\|
|00002440| 22 66 73 28 35 29 0a 2e | 53 48 20 41 55 54 48 4f |"fs(5)..|SH AUTHO|
|00002450| 52 0a 57 65 72 6e 65 72 | 20 41 6c 6d 65 73 62 65 |R.Werner| Almesbe|
|00002460| 72 67 65 72 20 3c 61 6c | 6d 65 73 62 65 72 40 62 |rger <al|mesber@b|
|00002470| 65 72 6e 69 6e 61 2e 65 | 74 68 7a 2e 63 68 3e 0a |ernina.e|thz.ch>.|
|00002480| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002490| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000024f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000025f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002600| 64 6f 73 66 73 63 6b 2f | 62 6f 6f 74 2e 63 00 00 |dosfsck/|boot.c..|
|00002610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002660| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00002670| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00002680| 20 20 20 35 35 34 33 20 | 20 35 33 37 32 36 30 33 | 5543 | 5372603|
|00002690| 34 34 37 20 20 31 31 36 | 34 30 00 20 30 00 00 00 |447 116|40. 0...|
|000026a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002700| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00002710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002720| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00002730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000027f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002800| 2f 2a 20 62 6f 6f 74 2e | 63 20 20 2d 20 20 52 65 |/* boot.|c - Re|
|00002810| 61 64 20 61 6e 64 20 61 | 6e 61 6c 79 7a 65 20 69 |ad and a|nalyze i|
|00002820| 61 20 50 43 2f 4d 53 2d | 44 4f 53 20 62 6f 6f 74 |a PC/MS-|DOS boot|
|00002830| 20 73 65 63 74 6f 72 20 | 2a 2f 0a 0a 2f 2a 20 57 | sector |*/../* W|
|00002840| 72 69 74 74 65 6e 20 31 | 39 39 33 20 62 79 20 57 |ritten 1|993 by W|
|00002850| 65 72 6e 65 72 20 41 6c | 6d 65 73 62 65 72 67 65 |erner Al|mesberge|
|00002860| 72 20 2a 2f 0a 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |r */...#|include |
|00002870| 3c 73 74 64 69 6f 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<stdio.h|>.#inclu|
|00002880| 64 65 20 3c 6c 69 6e 75 | 78 2f 6d 73 64 6f 73 5f |de <linu|x/msdos_|
|00002890| 66 73 2e 68 3e 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |fs.h>..#|include |
|000028a0| 22 63 6f 6d 6d 6f 6e 2e | 68 22 0a 23 69 6e 63 6c |"common.|h".#incl|
|000028b0| 75 64 65 20 22 64 6f 73 | 66 73 63 6b 2e 68 22 0a |ude "dos|fsck.h".|
|000028c0| 23 69 6e 63 6c 75 64 65 | 20 22 69 6f 2e 68 22 0a |#include| "io.h".|
|000028d0| 23 69 6e 63 6c 75 64 65 | 20 22 62 6f 6f 74 2e 68 |#include| "boot.h|
|000028e0| 22 0a 0a 0a 23 64 65 66 | 69 6e 65 20 52 4f 55 4e |"...#def|ine ROUN|
|000028f0| 44 5f 54 4f 5f 4d 55 4c | 54 49 50 4c 45 28 6e 2c |D_TO_MUL|TIPLE(n,|
|00002900| 6d 29 20 28 28 6e 29 20 | 26 26 20 28 6d 29 20 3f |m) ((n) |&& (m) ?|
|00002910| 20 28 6e 29 2b 28 6d 29 | 2d 31 2d 28 28 6e 29 2d | (n)+(m)|-1-((n)-|
|00002920| 31 29 25 28 6d 29 20 3a | 20 30 29 0a 20 20 20 20 |1)%(m) :| 0). |
|00002930| 2f 2a 20 64 6f 6e 27 74 | 20 64 69 76 69 64 65 20 |/* don't| divide |
|00002940| 62 79 20 7a 65 72 6f 20 | 2a 2f 0a 0a 0a 73 74 61 |by zero |*/...sta|
|00002950| 74 69 63 20 76 6f 69 64 | 20 64 75 6d 70 5f 62 6f |tic void| dump_bo|
|00002960| 6f 74 28 44 4f 53 5f 46 | 53 20 2a 66 73 2c 73 74 |ot(DOS_F|S *fs,st|
|00002970| 72 75 63 74 20 6d 73 64 | 6f 73 5f 62 6f 6f 74 5f |ruct msd|os_boot_|
|00002980| 73 65 63 74 6f 72 20 2a | 62 29 0a 7b 0a 20 20 20 |sector *|b).{. |
|00002990| 20 70 72 69 6e 74 66 28 | 22 42 6f 6f 74 20 73 65 | printf(|"Boot se|
|000029a0| 63 74 6f 72 20 63 6f 6e | 74 65 6e 74 73 3a 5c 6e |ctor con|tents:\n|
|000029b0| 22 29 3b 0a 20 20 20 20 | 70 72 69 6e 74 66 28 22 |");. |printf("|
|000029c0| 25 31 30 64 20 62 79 74 | 65 73 20 70 65 72 20 6c |%10d byt|es per l|
|000029d0| 6f 67 69 63 61 6c 20 73 | 65 63 74 6f 72 5c 6e 22 |ogical s|ector\n"|
|000029e0| 2c 43 46 5f 4c 45 5f 57 | 28 2a 28 75 6e 73 69 67 |,CF_LE_W|(*(unsig|
|000029f0| 6e 65 64 20 73 68 6f 72 | 74 20 2a 29 0a 20 20 20 |ned shor|t *). |
|00002a00| 20 20 20 26 62 2d 3e 73 | 65 63 74 6f 72 5f 73 69 | &b->s|ector_si|
|00002a10| 7a 65 29 29 3b 0a 20 20 | 20 20 70 72 69 6e 74 66 |ze));. | printf|
|00002a20| 28 22 25 31 30 64 20 62 | 79 74 65 73 20 70 65 72 |("%10d b|ytes per|
|00002a30| 20 63 6c 75 73 74 65 72 | 5c 6e 22 2c 66 73 2d 3e | cluster|\n",fs->|
|00002a40| 63 6c 75 73 74 65 72 5f | 73 69 7a 65 29 3b 0a 20 |cluster_|size);. |
|00002a50| 20 20 20 70 72 69 6e 74 | 66 28 22 25 31 30 64 20 | print|f("%10d |
|00002a60| 72 65 73 65 72 76 65 64 | 20 73 65 63 74 6f 72 73 |reserved| sectors|
|00002a70| 5c 6e 22 2c 43 46 5f 4c | 45 5f 57 28 62 2d 3e 72 |\n",CF_L|E_W(b->r|
|00002a80| 65 73 65 72 76 65 64 29 | 29 3b 0a 20 20 20 20 70 |eserved)|);. p|
|00002a90| 72 69 6e 74 66 28 22 46 | 69 72 73 74 20 46 41 54 |rintf("F|irst FAT|
|00002aa0| 20 73 74 61 72 74 73 20 | 61 74 20 62 79 74 65 20 | starts |at byte |
|00002ab0| 25 75 5c 6e 22 2c 66 73 | 2d 3e 66 61 74 5f 73 74 |%u\n",fs|->fat_st|
|00002ac0| 61 72 74 29 3b 0a 20 20 | 20 20 70 72 69 6e 74 66 |art);. | printf|
|00002ad0| 28 22 25 31 30 64 20 46 | 41 54 73 5c 6e 22 2c 62 |("%10d F|ATs\n",b|
|00002ae0| 2d 3e 66 61 74 73 29 3b | 0a 20 20 20 20 70 72 69 |->fats);|. pri|
|00002af0| 6e 74 66 28 22 25 31 30 | 64 20 62 79 74 65 73 20 |ntf("%10|d bytes |
|00002b00| 70 65 72 20 46 41 54 5c | 6e 22 2c 66 73 2d 3e 66 |per FAT\|n",fs->f|
|00002b10| 61 74 5f 73 69 7a 65 29 | 3b 0a 20 20 20 20 70 72 |at_size)|;. pr|
|00002b20| 69 6e 74 66 28 22 52 6f | 6f 74 20 64 69 72 65 63 |intf("Ro|ot direc|
|00002b30| 74 6f 72 79 20 73 74 61 | 72 74 73 20 61 74 20 62 |tory sta|rts at b|
|00002b40| 79 74 65 20 25 75 5c 6e | 22 2c 66 73 2d 3e 72 6f |yte %u\n|",fs->ro|
|00002b50| 6f 74 5f 73 74 61 72 74 | 29 3b 0a 20 20 20 20 70 |ot_start|);. p|
|00002b60| 72 69 6e 74 66 28 22 25 | 31 30 64 20 72 6f 6f 74 |rintf("%|10d root|
|00002b70| 20 64 69 72 65 63 74 6f | 72 79 20 65 6e 74 72 69 | directo|ry entri|
|00002b80| 65 73 5c 6e 22 2c 66 73 | 2d 3e 72 6f 6f 74 5f 65 |es\n",fs|->root_e|
|00002b90| 6e 74 72 69 65 73 29 3b | 0a 20 20 20 20 70 72 69 |ntries);|. pri|
|00002ba0| 6e 74 66 28 22 44 61 74 | 61 20 61 72 65 61 20 73 |ntf("Dat|a area s|
|00002bb0| 74 61 72 74 73 20 61 74 | 20 62 79 74 65 20 25 75 |tarts at| byte %u|
|00002bc0| 5c 6e 22 2c 66 73 2d 3e | 64 61 74 61 5f 73 74 61 |\n",fs->|data_sta|
|00002bd0| 72 74 29 3b 0a 20 20 20 | 20 70 72 69 6e 74 66 28 |rt);. | printf(|
|00002be0| 22 25 31 30 75 20 64 61 | 74 61 20 63 6c 75 73 74 |"%10u da|ta clust|
|00002bf0| 65 72 73 20 28 25 75 20 | 62 79 74 65 73 29 5c 6e |ers (%u |bytes)\n|
|00002c00| 22 2c 66 73 2d 3e 63 6c | 75 73 74 65 72 73 2c 66 |",fs->cl|usters,f|
|00002c10| 73 2d 3e 63 6c 75 73 74 | 65 72 73 2a 0a 20 20 20 |s->clust|ers*. |
|00002c20| 20 20 20 66 73 2d 3e 63 | 6c 75 73 74 65 72 5f 73 | fs->c|luster_s|
|00002c30| 69 7a 65 29 3b 0a 7d 0a | 0a 0a 76 6f 69 64 20 72 |ize);.}.|..void r|
|00002c40| 65 61 64 5f 62 6f 6f 74 | 28 44 4f 53 5f 46 53 20 |ead_boot|(DOS_FS |
|00002c50| 2a 66 73 29 0a 7b 0a 20 | 20 20 20 73 74 72 75 63 |*fs).{. | struc|
|00002c60| 74 20 6d 73 64 6f 73 5f | 62 6f 6f 74 5f 73 65 63 |t msdos_|boot_sec|
|00002c70| 74 6f 72 20 62 3b 0a 20 | 20 20 20 69 6e 74 20 6c |tor b;. | int l|
|00002c80| 6f 67 69 63 61 6c 5f 73 | 65 63 74 6f 72 5f 73 69 |ogical_s|ector_si|
|00002c90| 7a 65 2c 66 61 74 5f 65 | 6e 74 72 69 65 73 2c 64 |ze,fat_e|ntries,d|
|00002ca0| 61 74 61 5f 73 69 7a 65 | 3b 0a 0a 20 20 20 20 66 |ata_size|;.. f|
|00002cb0| 73 5f 72 65 61 64 28 30 | 2c 73 69 7a 65 6f 66 28 |s_read(0|,sizeof(|
|00002cc0| 62 29 2c 26 62 29 3b 0a | 20 20 20 20 6c 6f 67 69 |b),&b);.| logi|
|00002cd0| 63 61 6c 5f 73 65 63 74 | 6f 72 5f 73 69 7a 65 20 |cal_sect|or_size |
|00002ce0| 3d 20 43 46 5f 4c 45 5f | 57 28 2a 28 75 6e 73 69 |= CF_LE_|W(*(unsi|
|00002cf0| 67 6e 65 64 20 73 68 6f | 72 74 20 2a 29 20 26 62 |gned sho|rt *) &b|
|00002d00| 2e 73 65 63 74 6f 72 5f | 73 69 7a 65 29 3b 0a 20 |.sector_|size);. |
|00002d10| 20 20 20 66 73 2d 3e 63 | 6c 75 73 74 65 72 5f 73 | fs->c|luster_s|
|00002d20| 69 7a 65 20 3d 20 62 2e | 63 6c 75 73 74 65 72 5f |ize = b.|cluster_|
|00002d30| 73 69 7a 65 2a 6c 6f 67 | 69 63 61 6c 5f 73 65 63 |size*log|ical_sec|
|00002d40| 74 6f 72 5f 73 69 7a 65 | 3b 0a 20 20 20 20 69 66 |tor_size|;. if|
|00002d50| 20 28 62 2e 66 61 74 73 | 20 21 3d 20 32 29 0a 09 | (b.fats| != 2)..|
|00002d60| 64 69 65 28 22 43 75 72 | 72 65 6e 74 6c 79 2c 20 |die("Cur|rently, |
|00002d70| 6f 6e 6c 79 20 32 20 46 | 41 54 73 20 61 72 65 20 |only 2 F|ATs are |
|00002d80| 73 75 70 70 6f 72 74 65 | 64 2c 20 6e 6f 74 20 25 |supporte|d, not %|
|00002d90| 64 2e 5c 6e 22 2c 62 2e | 66 61 74 73 29 3b 0a 20 |d.\n",b.|fats);. |
|00002da0| 20 20 20 66 73 2d 3e 66 | 61 74 5f 73 74 61 72 74 | fs->f|at_start|
|00002db0| 20 3d 20 43 46 5f 4c 45 | 5f 57 28 62 2e 72 65 73 | = CF_LE|_W(b.res|
|00002dc0| 65 72 76 65 64 29 2a 6c | 6f 67 69 63 61 6c 5f 73 |erved)*l|ogical_s|
|00002dd0| 65 63 74 6f 72 5f 73 69 | 7a 65 3b 0a 20 20 20 20 |ector_si|ze;. |
|00002de0| 66 73 2d 3e 66 61 74 5f | 73 69 7a 65 20 3d 20 43 |fs->fat_|size = C|
|00002df0| 46 5f 4c 45 5f 57 28 62 | 2e 66 61 74 5f 6c 65 6e |F_LE_W(b|.fat_len|
|00002e00| 67 74 68 29 2a 6c 6f 67 | 69 63 61 6c 5f 73 65 63 |gth)*log|ical_sec|
|00002e10| 74 6f 72 5f 73 69 7a 65 | 3b 0a 20 20 20 20 66 73 |tor_size|;. fs|
|00002e20| 2d 3e 72 6f 6f 74 5f 73 | 74 61 72 74 20 3d 20 28 |->root_s|tart = (|
|00002e30| 43 46 5f 4c 45 5f 57 28 | 62 2e 72 65 73 65 72 76 |CF_LE_W(|b.reserv|
|00002e40| 65 64 29 2b 62 2e 66 61 | 74 73 2a 43 46 5f 4c 45 |ed)+b.fa|ts*CF_LE|
|00002e50| 5f 57 28 62 2e 66 61 74 | 5f 6c 65 6e 67 74 68 29 |_W(b.fat|_length)|
|00002e60| 29 2a 0a 20 20 20 20 20 | 20 6c 6f 67 69 63 61 6c |)*. | logical|
|00002e70| 5f 73 65 63 74 6f 72 5f | 73 69 7a 65 3b 0a 20 20 |_sector_|size;. |
|00002e80| 20 20 66 73 2d 3e 72 6f | 6f 74 5f 65 6e 74 72 69 | fs->ro|ot_entri|
|00002e90| 65 73 20 3d 20 43 46 5f | 4c 45 5f 57 28 2a 28 28 |es = CF_|LE_W(*((|
|00002ea0| 75 6e 73 69 67 6e 65 64 | 20 73 68 6f 72 74 20 2a |unsigned| short *|
|00002eb0| 29 20 26 62 2e 64 69 72 | 5f 65 6e 74 72 69 65 73 |) &b.dir|_entries|
|00002ec0| 29 29 3b 0a 20 20 20 20 | 66 73 2d 3e 64 61 74 61 |));. |fs->data|
|00002ed0| 5f 73 74 61 72 74 20 3d | 20 66 73 2d 3e 72 6f 6f |_start =| fs->roo|
|00002ee0| 74 5f 73 74 61 72 74 2b | 52 4f 55 4e 44 5f 54 4f |t_start+|ROUND_TO|
|00002ef0| 5f 4d 55 4c 54 49 50 4c | 45 28 66 73 2d 3e 72 6f |_MULTIPL|E(fs->ro|
|00002f00| 6f 74 5f 65 6e 74 72 69 | 65 73 20 3c 3c 0a 20 20 |ot_entri|es <<. |
|00002f10| 20 20 20 20 4d 53 44 4f | 53 5f 44 49 52 5f 42 49 | MSDO|S_DIR_BI|
|00002f20| 54 53 2c 6c 6f 67 69 63 | 61 6c 5f 73 65 63 74 6f |TS,logic|al_secto|
|00002f30| 72 5f 73 69 7a 65 29 3b | 0a 20 20 20 20 64 61 74 |r_size);|. dat|
|00002f40| 61 5f 73 69 7a 65 20 3d | 20 28 43 46 5f 4c 45 5f |a_size =| (CF_LE_|
|00002f50| 57 28 2a 28 28 75 6e 73 | 69 67 6e 65 64 20 73 68 |W(*((uns|igned sh|
|00002f60| 6f 72 74 20 2a 29 20 26 | 62 2e 73 65 63 74 6f 72 |ort *) &|b.sector|
|00002f70| 73 29 29 20 3f 20 43 46 | 5f 4c 45 5f 57 28 0a 20 |s)) ? CF|_LE_W(. |
|00002f80| 20 20 20 20 20 2a 28 28 | 75 6e 73 69 67 6e 65 64 | *((|unsigned|
|00002f90| 20 73 68 6f 72 74 20 2a | 29 20 26 62 2e 73 65 63 | short *|) &b.sec|
|00002fa0| 74 6f 72 73 29 29 20 3a | 20 43 46 5f 4c 45 5f 4c |tors)) :| CF_LE_L|
|00002fb0| 28 62 2e 74 6f 74 61 6c | 5f 73 65 63 74 29 29 2a |(b.total|_sect))*|
|00002fc0| 0a 20 20 20 20 20 20 6c | 6f 67 69 63 61 6c 5f 73 |. l|ogical_s|
|00002fd0| 65 63 74 6f 72 5f 73 69 | 7a 65 2d 66 73 2d 3e 64 |ector_si|ze-fs->d|
|00002fe0| 61 74 61 5f 73 74 61 72 | 74 3b 0a 20 20 20 20 69 |ata_star|t;. i|
|00002ff0| 66 20 28 21 66 73 2d 3e | 63 6c 75 73 74 65 72 5f |f (!fs->|cluster_|
|00003000| 73 69 7a 65 29 20 64 69 | 65 28 22 43 6c 75 73 74 |size) di|e("Clust|
|00003010| 65 72 20 73 69 7a 65 20 | 69 73 20 7a 65 72 6f 2e |er size |is zero.|
|00003020| 22 29 3b 0a 20 20 20 20 | 69 66 20 28 21 6c 6f 67 |");. |if (!log|
|00003030| 69 63 61 6c 5f 73 65 63 | 74 6f 72 5f 73 69 7a 65 |ical_sec|tor_size|
|00003040| 29 20 64 69 65 28 22 4c | 6f 67 69 63 61 6c 20 73 |) die("L|ogical s|
|00003050| 65 63 74 6f 72 20 73 69 | 7a 65 20 69 73 20 7a 65 |ector si|ze is ze|
|00003060| 72 6f 2e 22 29 3b 0a 20 | 20 20 20 66 73 2d 3e 63 |ro.");. | fs->c|
|00003070| 6c 75 73 74 65 72 73 20 | 3d 20 64 61 74 61 5f 73 |lusters |= data_s|
|00003080| 69 7a 65 2f 66 73 2d 3e | 63 6c 75 73 74 65 72 5f |ize/fs->|cluster_|
|00003090| 73 69 7a 65 3b 0a 20 20 | 20 20 66 61 74 5f 65 6e |size;. | fat_en|
|000030a0| 74 72 69 65 73 20 3d 20 | 28 66 73 2d 3e 63 6c 75 |tries = |(fs->clu|
|000030b0| 73 74 65 72 73 20 3e 20 | 4d 53 44 4f 53 5f 46 41 |sters > |MSDOS_FA|
|000030c0| 54 31 32 20 3f 20 66 73 | 2d 3e 66 61 74 5f 73 69 |T12 ? fs|->fat_si|
|000030d0| 7a 65 2f 32 20 3a 0a 20 | 20 20 20 20 20 66 73 2d |ze/2 :. | fs-|
|000030e0| 3e 66 61 74 5f 73 69 7a | 65 2a 32 2f 33 29 2d 32 |>fat_siz|e*2/3)-2|
|000030f0| 3b 0a 20 20 20 20 69 66 | 20 28 66 73 2d 3e 63 6c |;. if| (fs->cl|
|00003100| 75 73 74 65 72 73 20 3e | 20 66 61 74 5f 65 6e 74 |usters >| fat_ent|
|00003110| 72 69 65 73 29 0a 09 64 | 69 65 28 22 46 69 6c 65 |ries)..d|ie("File|
|00003120| 20 73 79 73 74 65 6d 20 | 68 61 73 20 25 64 20 63 | system |has %d c|
|00003130| 6c 75 73 74 65 72 73 20 | 62 75 74 20 6f 6e 6c 79 |lusters |but only|
|00003140| 20 73 70 61 63 65 20 66 | 6f 72 20 25 64 20 46 41 | space f|or %d FA|
|00003150| 54 20 65 6e 74 72 69 65 | 73 2e 22 2c 0a 09 20 20 |T entrie|s.",.. |
|00003160| 66 73 2d 3e 63 6c 75 73 | 74 65 72 73 2c 66 61 74 |fs->clus|ters,fat|
|00003170| 5f 65 6e 74 72 69 65 73 | 29 3b 0a 20 20 20 20 69 |_entries|);. i|
|00003180| 66 20 28 21 66 73 2d 3e | 72 6f 6f 74 5f 65 6e 74 |f (!fs->|root_ent|
|00003190| 72 69 65 73 29 20 64 69 | 65 28 22 52 6f 6f 74 20 |ries) di|e("Root |
|000031a0| 64 69 72 65 63 74 6f 72 | 79 20 68 61 73 20 7a 65 |director|y has ze|
|000031b0| 72 6f 20 73 69 7a 65 2e | 22 29 3b 0a 20 20 20 20 |ro size.|");. |
|000031c0| 69 66 20 28 66 73 2d 3e | 72 6f 6f 74 5f 65 6e 74 |if (fs->|root_ent|
|000031d0| 72 69 65 73 20 26 20 28 | 4d 53 44 4f 53 5f 44 50 |ries & (|MSDOS_DP|
|000031e0| 53 2d 31 29 29 0a 09 64 | 69 65 28 22 52 6f 6f 74 |S-1))..d|ie("Root|
|000031f0| 20 64 69 72 65 63 74 6f | 72 79 20 28 25 64 20 65 | directo|ry (%d e|
|00003200| 6e 74 72 69 65 73 29 20 | 64 6f 65 73 6e 27 74 20 |ntries) |doesn't |
|00003210| 73 70 61 6e 20 61 6e 20 | 69 6e 74 65 67 72 61 6c |span an |integral|
|00003220| 20 6e 75 6d 62 65 72 20 | 6f 66 20 22 0a 09 20 20 | number |of ".. |
|00003230| 22 73 65 63 74 6f 72 73 | 2e 22 2c 66 73 2d 3e 72 |"sectors|.",fs->r|
|00003240| 6f 6f 74 5f 65 6e 74 72 | 69 65 73 29 3b 0a 20 20 |oot_entr|ies);. |
|00003250| 20 20 69 66 20 28 6c 6f | 67 69 63 61 6c 5f 73 65 | if (lo|gical_se|
|00003260| 63 74 6f 72 5f 73 69 7a | 65 20 26 20 28 53 45 43 |ctor_siz|e & (SEC|
|00003270| 54 4f 52 5f 53 49 5a 45 | 2d 31 29 29 0a 09 64 69 |TOR_SIZE|-1))..di|
|00003280| 65 28 22 4c 6f 67 69 63 | 61 6c 20 73 65 63 74 6f |e("Logic|al secto|
|00003290| 72 20 73 69 7a 65 20 28 | 25 64 20 62 79 74 65 73 |r size (|%d bytes|
|000032a0| 29 20 69 73 20 6e 6f 74 | 20 61 20 6d 75 6c 74 69 |) is not| a multi|
|000032b0| 70 6c 65 20 6f 66 20 74 | 68 65 20 70 68 79 73 69 |ple of t|he physi|
|000032c0| 63 61 6c 20 22 0a 09 20 | 20 22 73 65 63 74 6f 72 |cal ".. | "sector|
|000032d0| 20 73 69 7a 65 2e 22 2c | 6c 6f 67 69 63 61 6c 5f | size.",|logical_|
|000032e0| 73 65 63 74 6f 72 5f 73 | 69 7a 65 29 3b 0a 20 20 |sector_s|ize);. |
|000032f0| 20 20 69 66 20 28 21 62 | 2e 73 65 63 73 5f 74 72 | if (!b|.secs_tr|
|00003300| 61 63 6b 20 7c 7c 20 21 | 62 2e 68 65 61 64 73 29 |ack || !|b.heads)|
|00003310| 0a 09 64 69 65 28 22 49 | 6e 76 61 6c 69 64 20 64 |..die("I|nvalid d|
|00003320| 69 73 6b 20 66 6f 72 6d | 61 74 20 69 6e 20 62 6f |isk form|at in bo|
|00003330| 6f 74 20 73 65 63 74 6f | 72 2e 22 29 3b 0a 20 20 |ot secto|r.");. |
|00003340| 20 20 69 66 20 28 76 65 | 72 62 6f 73 65 29 20 64 | if (ve|rbose) d|
|00003350| 75 6d 70 5f 62 6f 6f 74 | 28 66 73 2c 26 62 29 3b |ump_boot|(fs,&b);|
|00003360| 0a 7d 0a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.}......|........|
|00003370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003400| 64 6f 73 66 73 63 6b 2f | 62 6f 6f 74 2e 68 00 00 |dosfsck/|boot.h..|
|00003410| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00003470| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00003480| 20 20 20 20 33 37 34 20 | 20 35 33 37 32 36 30 33 | 374 | 5372603|
|00003490| 31 34 36 20 20 31 31 36 | 31 36 00 20 30 00 00 00 |146 116|16. 0...|
|000034a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003500| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00003510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003520| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00003530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003600| 2f 2a 20 62 6f 6f 74 2e | 68 20 20 2d 20 20 52 65 |/* boot.|h - Re|
|00003610| 61 64 20 61 6e 64 20 61 | 6e 61 6c 79 7a 65 20 69 |ad and a|nalyze i|
|00003620| 61 20 50 43 2f 4d 53 2d | 44 4f 53 20 62 6f 6f 74 |a PC/MS-|DOS boot|
|00003630| 20 73 65 63 74 6f 72 20 | 2a 2f 0a 0a 2f 2a 20 57 | sector |*/../* W|
|00003640| 72 69 74 74 65 6e 20 31 | 39 39 33 20 62 79 20 57 |ritten 1|993 by W|
|00003650| 65 72 6e 65 72 20 41 6c | 6d 65 73 62 65 72 67 65 |erner Al|mesberge|
|00003660| 72 20 2a 2f 0a 0a 0a 23 | 69 66 6e 64 65 66 20 5f |r */...#|ifndef _|
|00003670| 42 4f 4f 54 5f 48 0a 23 | 64 65 66 69 6e 65 20 5f |BOOT_H.#|define _|
|00003680| 42 4f 4f 54 5f 48 0a 0a | 76 6f 69 64 20 72 65 61 |BOOT_H..|void rea|
|00003690| 64 5f 62 6f 6f 74 28 44 | 4f 53 5f 46 53 20 2a 66 |d_boot(D|OS_FS *f|
|000036a0| 73 29 3b 0a 0a 2f 2a 20 | 52 65 61 64 73 20 74 68 |s);../* |Reads th|
|000036b0| 65 20 62 6f 6f 74 20 73 | 65 63 74 6f 72 20 66 72 |e boot s|ector fr|
|000036c0| 6f 6d 20 74 68 65 20 63 | 75 72 72 65 6e 74 6c 79 |om the c|urrently|
|000036d0| 20 6f 70 65 6e 20 64 65 | 76 69 63 65 20 61 6e 64 | open de|vice and|
|000036e0| 20 69 6e 69 74 69 61 6c | 69 7a 65 73 20 2a 46 53 | initial|izes *FS|
|000036f0| 20 2a 2f 0a 0a 23 65 6e | 64 69 66 0a 00 00 00 00 | */..#en|dif.....|
|00003700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003800| 64 6f 73 66 73 63 6b 2f | 63 68 65 63 6b 2e 63 00 |dosfsck/|check.c.|
|00003810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 20 |.... 6|44 . |
|00003870| 20 30 20 00 20 20 20 20 | 20 30 20 00 20 20 20 20 | 0 . | 0 . |
|00003880| 20 20 33 37 35 36 35 20 | 20 35 33 37 33 35 37 34 | 37565 | 5373574|
|00003890| 35 37 32 20 20 31 32 30 | 31 32 00 20 30 00 00 00 |572 120|12. 0...|
|000038a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003900| 00 75 73 74 61 72 20 20 | 00 72 6f 6f 74 00 00 00 |.ustar |.root...|
|00003910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003920| 00 00 00 00 00 00 00 00 | 00 72 6f 6f 74 00 00 00 |........|.root...|
|00003930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a00| 2f 2a 20 63 68 65 63 6b | 2e 63 20 20 2d 20 20 43 |/* check|.c - C|
|00003a10| 68 65 63 6b 20 61 6e 64 | 20 72 65 70 61 69 72 20 |heck and| repair |
|00003a20| 61 20 50 43 2f 4d 53 2d | 44 4f 53 20 66 69 6c 65 |a PC/MS-|DOS file|
|00003a30| 20 73 79 73 74 65 6d 20 | 2a 2f 0a 0a 2f 2a 20 57 | system |*/../* W|
|00003a40| 72 69 74 74 65 6e 20 31 | 39 39 33 20 62 79 20 57 |ritten 1|993 by W|
|00003a50| 65 72 6e 65 72 20 41 6c | 6d 65 73 62 65 72 67 65 |erner Al|mesberge|
|00003a60| 72 20 2a 2f 0a 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |r */...#|include |
|00003a70| 3c 73 74 64 69 6f 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<stdio.h|>.#inclu|
|00003a80| 64 65 20 3c 73 74 72 69 | 6e 67 2e 68 3e 0a 23 69 |de <stri|ng.h>.#i|
|00003a90| 6e 63 6c 75 64 65 20 3c | 6c 69 6d 69 74 73 2e 68 |nclude <|limits.h|
|00003aa0| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 74 69 6d 65 |>.#inclu|de <time|
|00003ab0| 2e 68 3e 0a 0a 23 69 6e | 63 6c 75 64 65 20 22 63 |.h>..#in|clude "c|
|00003ac0| 6f 6d 6d 6f 6e 2e 68 22 | 0a 23 69 6e 63 6c 75 64 |ommon.h"|.#includ|
|00003ad0| 65 20 22 64 6f 73 66 73 | 63 6b 2e 68 22 0a 23 69 |e "dosfs|ck.h".#i|
|00003ae0| 6e 63 6c 75 64 65 20 22 | 69 6f 2e 68 22 0a 23 69 |nclude "|io.h".#i|
|00003af0| 6e 63 6c 75 64 65 20 22 | 66 61 74 2e 68 22 0a 23 |nclude "|fat.h".#|
|00003b00| 69 6e 63 6c 75 64 65 20 | 22 66 69 6c 65 2e 68 22 |include |"file.h"|
|00003b10| 0a 23 69 6e 63 6c 75 64 | 65 20 22 63 68 65 63 6b |.#includ|e "check|
|00003b20| 2e 68 22 0a 0a 0a 73 74 | 61 74 69 63 20 44 4f 53 |.h"...st|atic DOS|
|00003b30| 5f 46 49 4c 45 20 2a 72 | 6f 6f 74 3b 0a 0a 0a 23 |_FILE *r|oot;...#|
|00003b40| 64 65 66 69 6e 65 20 4d | 4f 44 49 46 59 28 70 2c |define M|ODIFY(p,|
|00003b50| 69 2c 76 29 20 5c 0a 20 | 20 28 28 70 2d 3e 64 69 |i,v) \. | ((p->di|
|00003b60| 72 5f 65 6e 74 2e 69 20 | 3d 20 76 29 2c 20 5c 0a |r_ent.i |= v), \.|
|00003b70| 20 20 66 73 5f 77 72 69 | 74 65 28 70 2d 3e 6f 66 | fs_wri|te(p->of|
|00003b80| 66 73 65 74 2b 28 28 63 | 68 61 72 20 2a 29 20 26 |fset+((c|har *) &|
|00003b90| 70 2d 3e 64 69 72 5f 65 | 6e 74 2e 69 2d 28 63 68 |p->dir_e|nt.i-(ch|
|00003ba0| 61 72 20 2a 29 20 26 70 | 2d 3e 64 69 72 5f 65 6e |ar *) &p|->dir_en|
|00003bb0| 74 29 2c 20 5c 0a 20 20 | 20 73 69 7a 65 6f 66 28 |t), \. | sizeof(|
|00003bc0| 70 2d 3e 64 69 72 5f 65 | 6e 74 2e 69 29 2c 26 70 |p->dir_e|nt.i),&p|
|00003bd0| 2d 3e 64 69 72 5f 65 6e | 74 2e 69 29 29 0a 0a 0a |->dir_en|t.i))...|
|00003be0| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 70 61 74 |static c|har *pat|
|00003bf0| 68 5f 6e 61 6d 65 28 44 | 4f 53 5f 46 49 4c 45 20 |h_name(D|OS_FILE |
|00003c00| 2a 66 69 6c 65 29 0a 7b | 0a 20 20 20 20 73 74 61 |*file).{|. sta|
|00003c10| 74 69 63 20 63 68 61 72 | 20 70 61 74 68 5b 50 41 |tic char| path[PA|
|00003c20| 54 48 5f 4d 41 58 2a 32 | 5d 3b 0a 0a 20 20 20 20 |TH_MAX*2|];.. |
|00003c30| 69 66 20 28 21 66 69 6c | 65 29 20 2a 70 61 74 68 |if (!fil|e) *path|
|00003c40| 20 3d 20 30 3b 0a 20 20 | 20 20 65 6c 73 65 20 7b | = 0;. | else {|
|00003c50| 0a 09 69 66 20 28 73 74 | 72 6c 65 6e 28 70 61 74 |..if (st|rlen(pat|
|00003c60| 68 5f 6e 61 6d 65 28 66 | 69 6c 65 2d 3e 70 61 72 |h_name(f|ile->par|
|00003c70| 65 6e 74 29 29 20 3e 20 | 50 41 54 48 5f 4d 41 58 |ent)) > |PATH_MAX|
|00003c80| 29 0a 09 20 20 20 20 64 | 69 65 28 22 50 61 74 68 |).. d|ie("Path|
|00003c90| 20 6e 61 6d 65 20 74 6f | 6f 20 6c 6f 6e 67 2e 22 | name to|o long."|
|00003ca0| 29 3b 0a 09 73 74 72 63 | 61 74 28 70 61 74 68 2c |);..strc|at(path,|
|00003cb0| 22 2f 22 29 3b 0a 09 73 | 74 72 63 70 79 28 73 74 |"/");..s|trcpy(st|
|00003cc0| 72 72 63 68 72 28 70 61 | 74 68 2c 30 29 2c 66 69 |rrchr(pa|th,0),fi|
|00003cd0| 6c 65 5f 6e 61 6d 65 28 | 66 69 6c 65 2d 3e 64 69 |le_name(|file->di|
|00003ce0| 72 5f 65 6e 74 2e 6e 61 | 6d 65 29 29 3b 0a 20 20 |r_ent.na|me));. |
|00003cf0| 20 20 7d 0a 20 20 20 20 | 72 65 74 75 72 6e 20 70 | }. |return p|
|00003d00| 61 74 68 3b 0a 7d 0a 0a | 0a 73 74 61 74 69 63 20 |ath;.}..|.static |
|00003d10| 69 6e 74 20 64 61 79 5f | 6e 5b 5d 20 3d 20 7b 20 |int day_|n[] = { |
|00003d20| 30 2c 33 31 2c 35 39 2c | 39 30 2c 31 32 30 2c 31 |0,31,59,|90,120,1|
|00003d30| 35 31 2c 31 38 31 2c 32 | 31 32 2c 32 34 33 2c 32 |51,181,2|12,243,2|
|00003d40| 37 33 2c 33 30 34 2c 33 | 33 34 2c 30 2c 30 2c 30 |73,304,3|34,0,0,0|
|00003d50| 2c 30 20 7d 3b 0a 09 09 | 20 20 2f 2a 20 4a 61 6e |,0 };...| /* Jan|
|00003d60| 46 65 62 4d 61 72 41 70 | 72 20 4d 61 79 20 4a 75 |FebMarAp|r May Ju|
|00003d70| 6e 20 4a 75 6c 20 41 75 | 67 20 53 65 70 20 4f 63 |n Jul Au|g Sep Oc|
|00003d80| 74 20 4e 6f 76 20 44 65 | 63 20 2a 2f 0a 0a 0a 2f |t Nov De|c */.../|
|00003d90| 2a 20 43 6f 6e 76 65 72 | 74 20 61 20 4d 53 2d 44 |* Conver|t a MS-D|
|00003da0| 4f 53 20 74 69 6d 65 2f | 64 61 74 65 20 70 61 69 |OS time/|date pai|
|00003db0| 72 20 74 6f 20 61 20 55 | 4e 49 58 20 64 61 74 65 |r to a U|NIX date|
|00003dc0| 20 28 73 65 63 6f 6e 64 | 73 20 73 69 6e 63 65 20 | (second|s since |
|00003dd0| 31 20 31 20 37 30 29 2e | 20 2a 2f 0a 0a 69 6e 74 |1 1 70).| */..int|
|00003de0| 20 64 61 74 65 5f 64 6f | 73 32 75 6e 69 78 28 75 | date_do|s2unix(u|
|00003df0| 6e 73 69 67 6e 65 64 20 | 73 68 6f 72 74 20 74 69 |nsigned |short ti|
|00003e00| 6d 65 2c 75 6e 73 69 67 | 6e 65 64 20 73 68 6f 72 |me,unsig|ned shor|
|00003e10| 74 20 64 61 74 65 29 0a | 7b 0a 20 20 20 20 69 6e |t date).|{. in|
|00003e20| 74 20 6d 6f 6e 74 68 2c | 79 65 61 72 2c 73 65 63 |t month,|year,sec|
|00003e30| 73 3b 0a 0a 20 20 20 20 | 6d 6f 6e 74 68 20 3d 20 |s;.. |month = |
|00003e40| 28 28 64 61 74 65 20 3e | 3e 20 35 29 20 26 20 31 |((date >|> 5) & 1|
|00003e50| 35 29 2d 31 3b 0a 20 20 | 20 20 79 65 61 72 20 3d |5)-1;. | year =|
|00003e60| 20 64 61 74 65 20 3e 3e | 20 39 3b 0a 20 20 20 20 | date >>| 9;. |
|00003e70| 73 65 63 73 20 3d 20 28 | 74 69 6d 65 20 26 20 33 |secs = (|time & 3|
|00003e80| 31 29 2a 32 2b 36 30 2a | 28 28 74 69 6d 65 20 3e |1)*2+60*|((time >|
|00003e90| 3e 20 35 29 20 26 20 36 | 33 29 2b 28 74 69 6d 65 |> 5) & 6|3)+(time|
|00003ea0| 20 3e 3e 20 31 31 29 2a | 33 36 30 30 2b 38 36 34 | >> 11)*|3600+864|
|00003eb0| 30 30 2a 0a 20 20 20 20 | 20 20 28 28 64 61 74 65 |00*. | ((date|
|00003ec0| 20 26 20 33 31 29 2d 31 | 2b 64 61 79 5f 6e 5b 6d | & 31)-1|+day_n[m|
|00003ed0| 6f 6e 74 68 5d 2b 28 79 | 65 61 72 2f 34 29 2b 79 |onth]+(y|ear/4)+y|
|00003ee0| 65 61 72 2a 33 36 35 2d | 28 28 79 65 61 72 20 26 |ear*365-|((year &|
|00003ef0| 20 33 29 20 3d 3d 20 30 | 20 26 26 0a 20 20 20 20 | 3) == 0| &&. |
|00003f00| 20 20 6d 6f 6e 74 68 20 | 3c 20 32 20 3f 20 31 20 | month |< 2 ? 1 |
|00003f10| 3a 20 30 29 2b 33 36 35 | 33 29 3b 0a 20 20 20 20 |: 0)+365|3);. |
|00003f20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003f30| 20 20 20 2f 2a 20 64 61 | 79 73 20 73 69 6e 63 65 | /* da|ys since|
|00003f40| 20 31 2e 31 2e 37 30 20 | 70 6c 75 73 20 38 30 27 | 1.1.70 |plus 80'|
|00003f50| 73 20 6c 65 61 70 20 64 | 61 79 20 2a 2f 0a 20 20 |s leap d|ay */. |
|00003f60| 20 20 72 65 74 75 72 6e | 20 73 65 63 73 3b 0a 7d | return| secs;.}|
|00003f70| 0a 0a 0a 73 74 61 74 69 | 63 20 63 68 61 72 20 2a |...stati|c char *|
|00003f80| 66 69 6c 65 5f 73 74 61 | 74 28 44 4f 53 5f 46 49 |file_sta|t(DOS_FI|
|00003f90| 4c 45 20 2a 66 69 6c 65 | 29 0a 7b 0a 20 20 20 20 |LE *file|).{. |
|00003fa0| 73 74 61 74 69 63 20 63 | 68 61 72 20 74 65 6d 70 |static c|har temp|
|00003fb0| 5b 31 30 30 5d 3b 0a 20 | 20 20 20 73 74 72 75 63 |[100];. | struc|
|00003fc0| 74 20 74 6d 20 2a 74 6d | 3b 0a 20 20 20 20 63 68 |t tm *tm|;. ch|
|00003fd0| 61 72 20 74 6d 70 5b 31 | 30 30 5d 3b 0a 20 20 20 |ar tmp[1|00];. |
|00003fe0| 20 69 6e 74 20 64 61 74 | 65 3b 0a 0a 20 20 20 20 | int dat|e;.. |
|00003ff0| 64 61 74 65 20 3d 20 64 | 61 74 65 5f 64 6f 73 32 |date = d|ate_dos2|
|00004000| 75 6e 69 78 28 43 46 5f | 4c 45 5f 57 28 66 69 6c |unix(CF_|LE_W(fil|
|00004010| 65 2d 3e 64 69 72 5f 65 | 6e 74 2e 74 69 6d 65 29 |e->dir_e|nt.time)|
|00004020| 2c 43 46 5f 4c 45 5f 57 | 28 66 69 6c 65 2d 3e 0a |,CF_LE_W|(file->.|
|00004030| 20 20 20 20 20 20 64 69 | 72 5f 65 6e 74 2e 64 61 | di|r_ent.da|
|00004040| 74 65 29 29 3b 0a 20 20 | 20 20 74 6d 20 3d 20 6c |te));. | tm = l|
|00004050| 6f 63 61 6c 74 69 6d 65 | 28 26 64 61 74 65 29 3b |ocaltime|(&date);|
|00004060| 0a 20 20 20 20 73 74 72 | 66 74 69 6d 65 28 74 6d |. str|ftime(tm|
|00004070| 70 2c 39 39 2c 22 25 48 | 3a 25 4d 3a 25 53 20 25 |p,99,"%H|:%M:%S %|
|00004080| 62 20 25 64 20 25 59 22 | 2c 74 6d 29 3b 0a 20 20 |b %d %Y"|,tm);. |
|00004090| 20 20 73 70 72 69 6e 74 | 66 28 74 65 6d 70 2c 22 | sprint|f(temp,"|
|000040a0| 20 20 53 69 7a 65 20 25 | 75 20 62 79 74 65 73 2c | Size %|u bytes,|
|000040b0| 20 64 61 74 65 20 25 73 | 22 2c 43 46 5f 4c 45 5f | date %s|",CF_LE_|
|000040c0| 4c 28 66 69 6c 65 2d 3e | 64 69 72 5f 65 6e 74 2e |L(file->|dir_ent.|
|000040d0| 73 69 7a 65 29 2c 74 6d | 70 29 3b 0a 20 20 20 20 |size),tm|p);. |
|000040e0| 72 65 74 75 72 6e 20 74 | 65 6d 70 3b 0a 7d 0a 0a |return t|emp;.}..|
|000040f0| 0a 73 74 61 74 69 63 20 | 69 6e 74 20 62 61 64 5f |.static |int bad_|
|00004100| 6e 61 6d 65 28 75 6e 73 | 69 67 6e 65 64 20 63 68 |name(uns|igned ch|
|00004110| 61 72 20 2a 6e 61 6d 65 | 29 0a 7b 0a 20 20 20 20 |ar *name|).{. |
|00004120| 69 6e 74 20 62 61 64 2c | 69 2c 73 70 63 3b 0a 0a |int bad,|i,spc;..|
|00004130| 20 20 20 20 62 61 64 20 | 3d 20 30 3b 0a 20 20 20 | bad |= 0;. |
|00004140| 20 66 6f 72 20 28 69 20 | 3d 20 30 3b 20 69 20 3c | for (i |= 0; i <|
|00004150| 20 4d 53 44 4f 53 5f 4e | 41 4d 45 3b 20 69 2b 2b | MSDOS_N|AME; i++|
|00004160| 29 20 7b 0a 09 69 66 20 | 28 6e 61 6d 65 5b 69 5d |) {..if |(name[i]|
|00004170| 20 3c 20 27 20 27 20 7c | 7c 20 6e 61 6d 65 5b 69 | < ' ' ||| name[i|
|00004180| 5d 20 3d 3d 20 30 78 37 | 66 29 20 62 61 64 20 2b |] == 0x7|f) bad +|
|00004190| 3d 20 32 3b 0a 09 65 6c | 73 65 20 69 66 20 28 6e |= 2;..el|se if (n|
|000041a0| 61 6d 65 5b 69 5d 20 3e | 20 30 78 37 66 29 20 62 |ame[i] >| 0x7f) b|
|000041b0| 61 64 2b 2b 3b 0a 09 20 | 20 20 20 65 6c 73 65 20 |ad++;.. | else |
|000041c0| 69 66 20 28 73 74 72 63 | 68 72 28 22 2a 3f 3c 3e |if (strc|hr("*?<>|
|000041d0| 7c 5c 22 5c 5c 2f 22 2c | 6e 61 6d 65 5b 69 5d 29 ||\"\\/",|name[i])|
|000041e0| 29 20 62 61 64 20 2b 3d | 20 32 3b 0a 20 20 20 20 |) bad +=| 2;. |
|000041f0| 7d 0a 20 20 20 20 73 70 | 63 20 3d 20 30 3b 0a 20 |}. sp|c = 0;. |
|00004200| 20 20 20 66 6f 72 20 28 | 69 20 3d 20 30 3b 20 69 | for (|i = 0; i|
|00004210| 20 3c 20 38 3b 20 69 2b | 2b 29 0a 09 69 66 20 28 | < 8; i+|+)..if (|
|00004220| 6e 61 6d 65 5b 69 5d 20 | 3d 3d 20 27 20 27 29 20 |name[i] |== ' ') |
|00004230| 73 70 63 2b 2b 3b 0a 09 | 65 6c 73 65 20 7b 0a 09 |spc++;..|else {..|
|00004240| 20 20 20 20 62 61 64 20 | 2b 3d 20 73 70 63 3b 0a | bad |+= spc;.|
|00004250| 09 20 20 20 20 73 70 63 | 20 3d 20 30 3b 0a 09 7d |. spc| = 0;..}|
|00004260| 0a 20 20 20 20 73 70 63 | 20 3d 20 30 3b 0a 20 20 |. spc| = 0;. |
|00004270| 20 20 66 6f 72 20 28 69 | 20 3d 20 38 3b 20 69 20 | for (i| = 8; i |
|00004280| 3c 20 31 31 3b 20 69 2b | 2b 29 0a 09 69 66 20 28 |< 11; i+|+)..if (|
|00004290| 6e 61 6d 65 5b 69 5d 20 | 3d 3d 20 27 20 27 29 20 |name[i] |== ' ') |
|000042a0| 73 70 63 2b 2b 3b 0a 09 | 65 6c 73 65 20 7b 0a 09 |spc++;..|else {..|
|000042b0| 20 20 20 20 62 61 64 20 | 2b 3d 20 73 70 63 3b 0a | bad |+= spc;.|
|000042c0| 09 20 20 20 20 73 70 63 | 20 3d 20 30 3b 0a 09 7d |. spc| = 0;..}|
|000042d0| 0a 20 20 20 20 72 65 74 | 75 72 6e 20 62 61 64 20 |. ret|urn bad |
|000042e0| 3e 20 35 3b 0a 7d 0a 0a | 0a 73 74 61 74 69 63 20 |> 5;.}..|.static |
|000042f0| 76 6f 69 64 20 64 72 6f | 70 5f 66 69 6c 65 28 44 |void dro|p_file(D|
|00004300| 4f 53 5f 46 53 20 2a 66 | 73 2c 44 4f 53 5f 46 49 |OS_FS *f|s,DOS_FI|
|00004310| 4c 45 20 2a 66 69 6c 65 | 29 0a 7b 0a 20 20 20 20 |LE *file|).{. |
|00004320| 69 6e 74 20 63 6c 75 73 | 74 65 72 3b 0a 0a 20 20 |int clus|ter;.. |
|00004330| 20 20 4d 4f 44 49 46 59 | 28 66 69 6c 65 2c 6e 61 | MODIFY|(file,na|
|00004340| 6d 65 5b 30 5d 2c 44 45 | 4c 45 54 45 44 5f 46 4c |me[0],DE|LETED_FL|
|00004350| 41 47 29 3b 0a 20 20 20 | 20 66 6f 72 20 28 63 6c |AG);. | for (cl|
|00004360| 75 73 74 65 72 20 3d 20 | 43 46 5f 4c 45 5f 57 28 |uster = |CF_LE_W(|
|00004370| 66 69 6c 65 2d 3e 64 69 | 72 5f 65 6e 74 2e 73 74 |file->di|r_ent.st|
|00004380| 61 72 74 29 3b 20 63 6c | 75 73 74 65 72 20 3e 20 |art); cl|uster > |
|00004390| 30 20 26 26 20 63 6c 75 | 73 74 65 72 20 3c 0a 20 |0 && clu|ster <. |
|000043a0| 20 20 20 20 20 66 73 2d | 3e 63 6c 75 73 74 65 72 | fs-|>cluster|
|000043b0| 73 2b 32 3b 20 63 6c 75 | 73 74 65 72 20 3d 20 6e |s+2; clu|ster = n|
|000043c0| 65 78 74 5f 63 6c 75 73 | 74 65 72 28 66 73 2c 63 |ext_clus|ter(fs,c|
|000043d0| 6c 75 73 74 65 72 29 29 | 0a 09 73 65 74 5f 6f 77 |luster))|..set_ow|
|000043e0| 6e 65 72 28 66 73 2c 63 | 6c 75 73 74 65 72 2c 4e |ner(fs,c|luster,N|
|000043f0| 55 4c 4c 29 3b 0a 7d 0a | 0a 0a 73 74 61 74 69 63 |ULL);.}.|..static|
|00004400| 20 76 6f 69 64 20 74 72 | 75 6e 63 61 74 65 5f 66 | void tr|uncate_f|
|00004410| 69 6c 65 28 44 4f 53 5f | 46 53 20 2a 66 73 2c 44 |ile(DOS_|FS *fs,D|
|00004420| 4f 53 5f 46 49 4c 45 20 | 2a 66 69 6c 65 2c 69 6e |OS_FILE |*file,in|
|00004430| 74 20 63 6c 75 73 74 65 | 72 73 29 0a 7b 0a 20 20 |t cluste|rs).{. |
|00004440| 20 20 69 6e 74 20 77 61 | 6c 6b 2c 6e 65 78 74 2c | int wa|lk,next,|
|00004450| 70 72 65 76 2c 64 65 6c | 65 74 69 6e 67 3b 0a 0a |prev,del|eting;..|
|00004460| 20 20 20 20 77 61 6c 6b | 20 3d 20 43 46 5f 4c 45 | walk| = CF_LE|
|00004470| 5f 57 28 66 69 6c 65 2d | 3e 64 69 72 5f 65 6e 74 |_W(file-|>dir_ent|
|00004480| 2e 73 74 61 72 74 29 3b | 0a 20 20 20 20 70 72 65 |.start);|. pre|
|00004490| 76 20 3d 20 30 3b 0a 20 | 20 20 20 69 66 20 28 64 |v = 0;. | if (d|
|000044a0| 65 6c 65 74 69 6e 67 20 | 3d 20 21 63 6c 75 73 74 |eleting |= !clust|
|000044b0| 65 72 73 29 20 4d 4f 44 | 49 46 59 28 66 69 6c 65 |ers) MOD|IFY(file|
|000044c0| 2c 73 74 61 72 74 2c 43 | 54 5f 4c 45 5f 4c 28 30 |,start,C|T_LE_L(0|
|000044d0| 29 29 3b 0a 20 20 20 20 | 77 68 69 6c 65 20 28 77 |));. |while (w|
|000044e0| 61 6c 6b 20 3e 20 30 29 | 20 7b 0a 09 6e 65 78 74 |alk > 0)| {..next|
|000044f0| 20 3d 20 6e 65 78 74 5f | 63 6c 75 73 74 65 72 28 | = next_|cluster(|
|00004500| 66 73 2c 77 61 6c 6b 29 | 3b 0a 09 69 66 20 28 64 |fs,walk)|;..if (d|
|00004510| 65 6c 65 74 69 6e 67 29 | 20 73 65 74 5f 66 61 74 |eleting)| set_fat|
|00004520| 28 66 73 2c 77 61 6c 6b | 2c 30 29 3b 0a 09 65 6c |(fs,walk|,0);..el|
|00004530| 73 65 20 69 66 20 28 64 | 65 6c 65 74 69 6e 67 20 |se if (d|eleting |
|00004540| 3d 20 21 2d 2d 63 6c 75 | 73 74 65 72 73 29 20 73 |= !--clu|sters) s|
|00004550| 65 74 5f 66 61 74 28 66 | 73 2c 77 61 6c 6b 2c 2d |et_fat(f|s,walk,-|
|00004560| 31 29 3b 0a 09 70 72 65 | 76 20 3d 20 77 61 6c 6b |1);..pre|v = walk|
|00004570| 3b 0a 09 77 61 6c 6b 20 | 3d 20 6e 65 78 74 3b 0a |;..walk |= next;.|
|00004580| 20 20 20 20 7d 0a 7d 0a | 0a 0a 73 74 61 74 69 63 | }.}.|..static|
|00004590| 20 76 6f 69 64 20 61 75 | 74 6f 5f 72 65 6e 61 6d | void au|to_renam|
|000045a0| 65 28 44 4f 53 5f 46 49 | 4c 45 20 2a 66 69 6c 65 |e(DOS_FI|LE *file|
|000045b0| 29 0a 7b 0a 20 20 20 20 | 44 4f 53 5f 46 49 4c 45 |).{. |DOS_FILE|
|000045c0| 20 2a 66 69 72 73 74 2c | 2a 77 61 6c 6b 3b 0a 20 | *first,|*walk;. |
|000045d0| 20 20 20 69 6e 74 20 6e | 75 6d 62 65 72 3b 0a 0a | int n|umber;..|
|000045e0| 20 20 20 20 66 69 72 73 | 74 20 3d 20 66 69 6c 65 | firs|t = file|
|000045f0| 2d 3e 70 61 72 65 6e 74 | 20 3f 20 66 69 6c 65 2d |->parent| ? file-|
|00004600| 3e 70 61 72 65 6e 74 2d | 3e 66 69 72 73 74 20 3a |>parent-|>first :|
|00004610| 20 72 6f 6f 74 3b 0a 20 | 20 20 20 6e 75 6d 62 65 | root;. | numbe|
|00004620| 72 20 3d 20 30 3b 0a 20 | 20 20 20 77 68 69 6c 65 |r = 0;. | while|
|00004630| 20 28 31 29 20 7b 0a 09 | 73 70 72 69 6e 74 66 28 | (1) {..|sprintf(|
|00004640| 66 69 6c 65 2d 3e 64 69 | 72 5f 65 6e 74 2e 6e 61 |file->di|r_ent.na|
|00004650| 6d 65 2c 22 46 53 43 4b | 25 30 34 64 22 2c 6e 75 |me,"FSCK|%04d",nu|
|00004660| 6d 62 65 72 29 3b 0a 09 | 73 74 72 6e 63 70 79 28 |mber);..|strncpy(|
|00004670| 66 69 6c 65 2d 3e 64 69 | 72 5f 65 6e 74 2e 65 78 |file->di|r_ent.ex|
|00004680| 74 2c 22 52 45 4e 22 2c | 33 29 3b 0a 09 66 6f 72 |t,"REN",|3);..for|
|00004690| 20 28 77 61 6c 6b 20 3d | 20 66 69 72 73 74 3b 20 | (walk =| first; |
|000046a0| 77 61 6c 6b 3b 20 77 61 | 6c 6b 20 3d 20 77 61 6c |walk; wa|lk = wal|
|000046b0| 6b 2d 3e 6e 65 78 74 29 | 0a 09 20 20 20 20 69 66 |k->next)|.. if|
|000046c0| 20 28 77 61 6c 6b 20 21 | 3d 20 66 69 6c 65 20 26 | (walk !|= file &|
|000046d0| 26 20 21 73 74 72 6e 63 | 6d 70 28 77 61 6c 6b 2d |& !strnc|mp(walk-|
|000046e0| 3e 64 69 72 5f 65 6e 74 | 2e 6e 61 6d 65 2c 66 69 |>dir_ent|.name,fi|
|000046f0| 6c 65 2d 3e 64 69 72 5f | 65 6e 74 2e 0a 09 20 20 |le->dir_|ent... |
|00004700| 20 20 20 20 6e 61 6d 65 | 2c 4d 53 44 4f 53 5f 4e | name|,MSDOS_N|
|00004710| 41 4d 45 29 29 20 62 72 | 65 61 6b 3b 0a 09 69 66 |AME)) br|eak;..if|
|00004720| 20 28 21 77 61 6c 6b 29 | 20 72 65 74 75 72 6e 3b | (!walk)| return;|
|00004730| 0a 09 6e 75 6d 62 65 72 | 2b 2b 3b 0a 20 20 20 20 |..number|++;. |
|00004740| 7d 0a 20 20 20 20 64 69 | 65 28 22 43 61 6e 27 74 |}. di|e("Can't|
|00004750| 20 67 65 6e 65 72 61 74 | 65 20 61 20 75 6e 69 71 | generat|e a uniq|
|00004760| 75 65 20 6e 61 6d 65 2e | 22 29 3b 0a 7d 0a 0a 0a |ue name.|");.}...|
|00004770| 73 74 61 74 69 63 20 76 | 6f 69 64 20 72 65 6e 61 |static v|oid rena|
|00004780| 6d 65 5f 66 69 6c 65 28 | 44 4f 53 5f 46 49 4c 45 |me_file(|DOS_FILE|
|00004790| 20 2a 66 69 6c 65 29 0a | 7b 0a 20 20 20 20 75 6e | *file).|{. un|
|000047a0| 73 69 67 6e 65 64 20 63 | 68 61 72 20 6e 61 6d 65 |signed c|har name|
|000047b0| 5b 34 36 5d 3b 0a 20 20 | 20 20 75 6e 73 69 67 6e |[46];. | unsign|
|000047c0| 65 64 20 63 68 61 72 20 | 2a 77 61 6c 6b 2c 2a 68 |ed char |*walk,*h|
|000047d0| 65 72 65 3b 0a 0a 20 20 | 20 20 77 68 69 6c 65 20 |ere;.. | while |
|000047e0| 28 31 29 20 7b 0a 09 70 | 72 69 6e 74 66 28 22 4e |(1) {..p|rintf("N|
|000047f0| 65 77 20 6e 61 6d 65 3a | 20 22 29 3b 0a 09 66 66 |ew name:| ");..ff|
|00004800| 6c 75 73 68 28 73 74 64 | 6f 75 74 29 3b 0a 09 69 |lush(std|out);..i|
|00004810| 66 20 28 66 67 65 74 73 | 28 6e 61 6d 65 2c 34 35 |f (fgets|(name,45|
|00004820| 2c 73 74 64 69 6e 29 29 | 20 7b 0a 09 20 20 20 20 |,stdin))| {.. |
|00004830| 69 66 20 28 68 65 72 65 | 20 3d 20 73 74 72 63 68 |if (here| = strch|
|00004840| 72 28 6e 61 6d 65 2c 27 | 5c 6e 27 29 29 20 2a 68 |r(name,'|\n')) *h|
|00004850| 65 72 65 20 3d 20 30 3b | 0a 09 20 20 20 20 66 6f |ere = 0;|.. fo|
|00004860| 72 20 28 77 61 6c 6b 20 | 3d 20 73 74 72 72 63 68 |r (walk |= strrch|
|00004870| 72 28 6e 61 6d 65 2c 30 | 29 3b 20 77 61 6c 6b 20 |r(name,0|); walk |
|00004880| 3e 3d 20 6e 61 6d 65 20 | 26 26 20 28 2a 77 61 6c |>= name |&& (*wal|
|00004890| 6b 20 3d 3d 20 27 20 27 | 20 7c 7c 0a 09 20 20 20 |k == ' '| ||.. |
|000048a0| 20 20 20 2a 77 61 6c 6b | 20 3d 3d 20 27 5c 74 27 | *walk| == '\t'|
|000048b0| 29 3b 20 77 61 6c 6b 2d | 2d 29 3b 0a 09 20 20 20 |); walk-|-);.. |
|000048c0| 20 77 61 6c 6b 5b 31 5d | 20 3d 20 30 3b 0a 09 20 | walk[1]| = 0;.. |
|000048d0| 20 20 20 66 6f 72 20 28 | 77 61 6c 6b 20 3d 20 6e | for (|walk = n|
|000048e0| 61 6d 65 3b 20 2a 77 61 | 6c 6b 20 3d 3d 20 27 20 |ame; *wa|lk == ' |
|000048f0| 27 20 7c 7c 20 2a 77 61 | 6c 6b 20 3d 3d 20 27 5c |' || *wa|lk == '\|
|00004900| 74 27 3b 20 77 61 6c 6b | 2b 2b 29 3b 0a 09 20 20 |t'; walk|++);.. |
|00004910| 20 20 69 66 20 28 66 69 | 6c 65 5f 63 76 74 28 77 | if (fi|le_cvt(w|
|00004920| 61 6c 6b 2c 66 69 6c 65 | 2d 3e 64 69 72 5f 65 6e |alk,file|->dir_en|
|00004930| 74 2e 6e 61 6d 65 29 29 | 20 72 65 74 75 72 6e 3b |t.name))| return;|
|00004940| 0a 09 7d 0a 20 20 20 20 | 7d 0a 7d 0a 0a 0a 73 74 |..}. |}.}...st|
|00004950| 61 74 69 63 20 69 6e 74 | 20 68 61 6e 64 6c 65 5f |atic int| handle_|
|00004960| 64 6f 74 28 44 4f 53 5f | 46 53 20 2a 66 73 2c 44 |dot(DOS_|FS *fs,D|
|00004970| 4f 53 5f 46 49 4c 45 20 | 2a 66 69 6c 65 2c 69 6e |OS_FILE |*file,in|
|00004980| 74 20 64 6f 74 73 29 0a | 7b 0a 20 20 20 20 63 68 |t dots).|{. ch|
|00004990| 61 72 20 2a 6e 61 6d 65 | 3b 0a 0a 20 20 20 20 6e |ar *name|;.. n|
|000049a0| 61 6d 65 20 3d 20 73 74 | 72 6e 63 6d 70 28 66 69 |ame = st|rncmp(fi|
|000049b0| 6c 65 2d 3e 64 69 72 5f | 65 6e 74 2e 6e 61 6d 65 |le->dir_|ent.name|
|000049c0| 2c 4d 53 44 4f 53 5f 44 | 4f 54 2c 4d 53 44 4f 53 |,MSDOS_D|OT,MSDOS|
|000049d0| 5f 4e 41 4d 45 29 20 3f | 20 22 2e 2e 22 20 3a 20 |_NAME) ?| ".." : |
|000049e0| 22 2e 22 3b 0a 20 20 20 | 20 69 66 20 28 21 28 66 |".";. | if (!(f|
|000049f0| 69 6c 65 2d 3e 64 69 72 | 5f 65 6e 74 2e 61 74 74 |ile->dir|_ent.att|
|00004a00| 72 20 26 20 41 54 54 52 | 5f 44 49 52 29 29 20 7b |r & ATTR|_DIR)) {|
|00004a10| 0a 09 70 72 69 6e 74 66 | 28 22 25 73 5c 6e 20 20 |..printf|("%s\n |
|00004a20| 49 73 20 61 20 6e 6f 6e | 2d 64 69 72 65 63 74 6f |Is a non|-directo|
|00004a30| 72 79 2e 5c 6e 22 2c 70 | 61 74 68 5f 6e 61 6d 65 |ry.\n",p|ath_name|
|00004a40| 28 66 69 6c 65 29 29 3b | 0a 09 69 66 20 28 69 6e |(file));|..if (in|
|00004a50| 74 65 72 61 63 74 69 76 | 65 29 0a 09 20 20 20 20 |teractiv|e).. |
|00004a60| 70 72 69 6e 74 66 28 22 | 31 29 20 44 72 6f 70 20 |printf("|1) Drop |
|00004a70| 69 74 5c 6e 32 29 20 41 | 75 74 6f 2d 72 65 6e 61 |it\n2) A|uto-rena|
|00004a80| 6d 65 5c 6e 33 29 20 52 | 65 6e 61 6d 65 5c 6e 22 |me\n3) R|ename\n"|
|00004a90| 0a 09 20 20 20 20 20 20 | 22 34 29 20 43 6f 6e 76 |.. |"4) Conv|
|00004aa0| 65 72 74 20 74 6f 20 64 | 69 72 65 63 74 6f 72 79 |ert to d|irectory|
|00004ab0| 5c 6e 22 29 3b 0a 09 65 | 6c 73 65 20 70 72 69 6e |\n");..e|lse prin|
|00004ac0| 74 66 28 22 20 20 41 75 | 74 6f 2d 72 65 6e 61 6d |tf(" Au|to-renam|
|00004ad0| 69 6e 67 20 69 74 2e 5c | 6e 22 29 3b 0a 09 73 77 |ing it.\|n");..sw|
|00004ae0| 69 74 63 68 20 28 69 6e | 74 65 72 61 63 74 69 76 |itch (in|teractiv|
|00004af0| 65 20 3f 20 67 65 74 5f | 6b 65 79 28 22 31 32 33 |e ? get_|key("123|
|00004b00| 34 22 2c 22 3f 22 29 20 | 3a 20 27 32 27 29 20 7b |4","?") |: '2') {|
|00004b10| 0a 09 20 20 20 20 63 61 | 73 65 20 27 31 27 3a 0a |.. ca|se '1':.|
|00004b20| 09 09 64 72 6f 70 5f 66 | 69 6c 65 28 66 73 2c 66 |..drop_f|ile(fs,f|
|00004b30| 69 6c 65 29 3b 0a 09 09 | 72 65 74 75 72 6e 20 31 |ile);...|return 1|
|00004b40| 3b 0a 09 20 20 20 20 63 | 61 73 65 20 27 32 27 3a |;.. c|ase '2':|
|00004b50| 0a 09 09 61 75 74 6f 5f | 72 65 6e 61 6d 65 28 66 |...auto_|rename(f|
|00004b60| 69 6c 65 29 3b 0a 09 09 | 70 72 69 6e 74 66 28 22 |ile);...|printf("|
|00004b70| 20 20 52 65 6e 61 6d 65 | 64 20 74 6f 20 25 73 5c | Rename|d to %s\|
|00004b80| 6e 22 2c 66 69 6c 65 5f | 6e 61 6d 65 28 66 69 6c |n",file_|name(fil|
|00004b90| 65 2d 3e 64 69 72 5f 65 | 6e 74 2e 6e 61 6d 65 29 |e->dir_e|nt.name)|
|00004ba0| 29 3b 0a 09 09 72 65 74 | 75 72 6e 20 30 3b 0a 09 |);...ret|urn 0;..|
|00004bb0| 20 20 20 20 63 61 73 65 | 20 27 33 27 3a 0a 09 09 | case| '3':...|
|00004bc0| 72 65 6e 61 6d 65 5f 66 | 69 6c 65 28 66 69 6c 65 |rename_f|ile(file|
|00004bd0| 29 3b 0a 09 09 72 65 74 | 75 72 6e 20 30 3b 0a 09 |);...ret|urn 0;..|
|00004be0| 20 20 20 20 63 61 73 65 | 20 27 34 27 3a 0a 09 09 | case| '4':...|
|00004bf0| 4d 4f 44 49 46 59 28 66 | 69 6c 65 2c 73 69 7a 65 |MODIFY(f|ile,size|
|00004c00| 2c 43 54 5f 4c 45 5f 4c | 28 30 29 29 3b 0a 09 09 |,CT_LE_L|(0));...|
|00004c10| 4d 4f 44 49 46 59 28 66 | 69 6c 65 2c 61 74 74 72 |MODIFY(f|ile,attr|
|00004c20| 2c 66 69 6c 65 2d 3e 64 | 69 72 5f 65 6e 74 2e 61 |,file->d|ir_ent.a|
|00004c30| 74 74 72 20 7c 20 41 54 | 54 52 5f 44 49 52 29 3b |ttr | AT|TR_DIR);|
|00004c40| 0a 09 09 62 72 65 61 6b | 3b 0a 09 7d 0a 20 20 20 |...break|;..}. |
|00004c50| 20 7d 0a 20 20 20 20 69 | 66 20 28 21 64 6f 74 73 | }. i|f (!dots|
|00004c60| 29 20 7b 0a 09 70 72 69 | 6e 74 66 28 22 52 6f 6f |) {..pri|ntf("Roo|
|00004c70| 74 20 63 6f 6e 74 61 69 | 6e 73 20 64 69 72 65 63 |t contai|ns direc|
|00004c80| 74 6f 72 79 20 5c 22 25 | 73 5c 22 2e 20 44 72 6f |tory \"%|s\". Dro|
|00004c90| 70 70 69 6e 67 20 69 74 | 2e 5c 6e 22 2c 6e 61 6d |pping it|.\n",nam|
|00004ca0| 65 29 3b 0a 09 64 72 6f | 70 5f 66 69 6c 65 28 66 |e);..dro|p_file(f|
|00004cb0| 73 2c 66 69 6c 65 29 3b | 0a 09 72 65 74 75 72 6e |s,file);|..return|
|00004cc0| 20 31 3b 0a 20 20 20 20 | 7d 0a 20 20 20 20 72 65 | 1;. |}. re|
|00004cd0| 74 75 72 6e 20 30 3b 0a | 7d 0a 0a 0a 73 74 61 74 |turn 0;.|}...stat|
|00004ce0| 69 63 20 69 6e 74 20 63 | 68 65 63 6b 5f 66 69 6c |ic int c|heck_fil|
|00004cf0| 65 28 44 4f 53 5f 46 53 | 20 2a 66 73 2c 44 4f 53 |e(DOS_FS| *fs,DOS|
|00004d00| 5f 46 49 4c 45 20 2a 66 | 69 6c 65 29 0a 7b 0a 20 |_FILE *f|ile).{. |
|00004d10| 20 20 20 44 4f 53 5f 46 | 49 4c 45 20 2a 6f 77 6e | DOS_F|ILE *own|
|00004d20| 65 72 3b 0a 20 20 20 20 | 69 6e 74 20 63 6c 75 73 |er;. |int clus|
|00004d30| 74 65 72 73 2c 70 72 65 | 76 2c 63 75 72 72 2c 74 |ters,pre|v,curr,t|
|00004d40| 68 69 73 2c 65 78 70 65 | 63 74 2c 72 65 73 74 61 |his,expe|ct,resta|
|00004d50| 72 74 3b 0a 20 20 20 20 | 69 6e 74 20 77 61 6c 6b |rt;. |int walk|
|00004d60| 2c 63 6c 75 73 74 65 72 | 73 32 3b 0a 0a 20 20 20 |,cluster|s2;.. |
|00004d70| 20 69 66 20 28 66 69 6c | 65 2d 3e 64 69 72 5f 65 | if (fil|e->dir_e|
|00004d80| 6e 74 2e 61 74 74 72 20 | 26 20 41 54 54 52 5f 44 |nt.attr |& ATTR_D|
|00004d90| 49 52 29 20 7b 0a 09 69 | 66 20 28 43 46 5f 4c 45 |IR) {..i|f (CF_LE|
|00004da0| 5f 4c 28 66 69 6c 65 2d | 3e 64 69 72 5f 65 6e 74 |_L(file-|>dir_ent|
|00004db0| 2e 73 69 7a 65 29 29 20 | 7b 0a 09 20 20 20 20 70 |.size)) |{.. p|
|00004dc0| 72 69 6e 74 66 28 22 25 | 73 5c 6e 20 20 44 69 72 |rintf("%|s\n Dir|
|00004dd0| 65 63 74 6f 72 79 20 68 | 61 73 20 6e 6f 6e 2d 7a |ectory h|as non-z|
|00004de0| 65 72 6f 20 73 69 7a 65 | 2e 20 46 69 78 69 6e 67 |ero size|. Fixing|
|00004df0| 20 69 74 2e 5c 6e 22 2c | 0a 09 20 20 20 20 20 20 | it.\n",|.. |
|00004e00| 70 61 74 68 5f 6e 61 6d | 65 28 66 69 6c 65 29 29 |path_nam|e(file))|
|00004e10| 3b 0a 09 20 20 20 20 4d | 4f 44 49 46 59 28 66 69 |;.. M|ODIFY(fi|
|00004e20| 6c 65 2c 73 69 7a 65 2c | 43 54 5f 4c 45 5f 4c 28 |le,size,|CT_LE_L(|
|00004e30| 30 29 29 3b 0a 09 7d 0a | 09 69 66 20 28 66 69 6c |0));..}.|.if (fil|
|00004e40| 65 2d 3e 70 61 72 65 6e | 74 20 26 26 20 21 73 74 |e->paren|t && !st|
|00004e50| 72 6e 63 6d 70 28 66 69 | 6c 65 2d 3e 64 69 72 5f |rncmp(fi|le->dir_|
|00004e60| 65 6e 74 2e 6e 61 6d 65 | 2c 4d 53 44 4f 53 5f 44 |ent.name|,MSDOS_D|
|00004e70| 4f 54 2c 4d 53 44 4f 53 | 5f 4e 41 4d 45 29 29 20 |OT,MSDOS|_NAME)) |
|00004e80| 7b 0a 09 20 20 20 20 65 | 78 70 65 63 74 20 3d 20 |{.. e|xpect = |
|00004e90| 43 46 5f 4c 45 5f 57 28 | 66 69 6c 65 2d 3e 70 61 |CF_LE_W(|file->pa|
|00004ea0| 72 65 6e 74 2d 3e 64 69 | 72 5f 65 6e 74 2e 73 74 |rent->di|r_ent.st|
|00004eb0| 61 72 74 29 3b 0a 09 20 | 20 20 20 69 66 20 28 43 |art);.. | if (C|
|00004ec0| 46 5f 4c 45 5f 57 28 66 | 69 6c 65 2d 3e 64 69 72 |F_LE_W(f|ile->dir|
|00004ed0| 5f 65 6e 74 2e 73 74 61 | 72 74 29 20 21 3d 20 65 |_ent.sta|rt) != e|
|00004ee0| 78 70 65 63 74 29 20 7b | 0a 09 09 70 72 69 6e 74 |xpect) {|...print|
|00004ef0| 66 28 22 25 73 5c 6e 20 | 20 53 74 61 72 74 20 28 |f("%s\n | Start (|
|00004f00| 25 64 29 20 64 6f 65 73 | 20 6e 6f 74 20 70 6f 69 |%d) does| not poi|
|00004f10| 6e 74 20 74 6f 20 70 61 | 72 65 6e 74 20 28 25 64 |nt to pa|rent (%d|
|00004f20| 29 5c 6e 22 2c 0a 09 09 | 20 20 70 61 74 68 5f 6e |)\n",...| path_n|
|00004f30| 61 6d 65 28 66 69 6c 65 | 29 2c 43 46 5f 4c 45 5f |ame(file|),CF_LE_|
|00004f40| 57 28 66 69 6c 65 2d 3e | 64 69 72 5f 65 6e 74 2e |W(file->|dir_ent.|
|00004f50| 73 74 61 72 74 29 2c 65 | 78 70 65 63 74 29 3b 0a |start),e|xpect);.|
|00004f60| 09 09 4d 4f 44 49 46 59 | 28 66 69 6c 65 2c 73 74 |..MODIFY|(file,st|
|00004f70| 61 72 74 2c 43 54 5f 4c | 45 5f 57 28 65 78 70 65 |art,CT_L|E_W(expe|
|00004f80| 63 74 29 29 3b 0a 09 20 | 20 20 20 7d 0a 09 20 20 |ct));.. | }.. |
|00004f90| 20 20 72 65 74 75 72 6e | 20 30 3b 0a 09 7d 0a 09 | return| 0;..}..|
|00004fa0| 69 66 20 28 66 69 6c 65 | 2d 3e 70 61 72 65 6e 74 |if (file|->parent|
|00004fb0| 20 26 26 20 21 73 74 72 | 6e 63 6d 70 28 66 69 6c | && !str|ncmp(fil|
|00004fc0| 65 2d 3e 64 69 72 5f 65 | 6e 74 2e 6e 61 6d 65 2c |e->dir_e|nt.name,|
|00004fd0| 4d 53 44 4f 53 5f 44 4f | 54 44 4f 54 2c 0a 09 20 |MSDOS_DO|TDOT,.. |
|00004fe0| 20 4d 53 44 4f 53 5f 4e | 41 4d 45 29 29 20 7b 0a | MSDOS_N|AME)) {.|
|00004ff0| 09 20 20 20 20 65 78 70 | 65 63 74 20 3d 20 66 69 |. exp|ect = fi|
|00005000| 6c 65 2d 3e 70 61 72 65 | 6e 74 2d 3e 70 61 72 65 |le->pare|nt->pare|
|00005010| 6e 74 20 3f 20 43 46 5f | 4c 45 5f 57 28 66 69 6c |nt ? CF_|LE_W(fil|
|00005020| 65 2d 3e 70 61 72 65 6e | 74 2d 3e 70 61 72 65 6e |e->paren|t->paren|
|00005030| 74 2d 3e 0a 09 20 20 20 | 20 20 20 64 69 72 5f 65 |t->.. | dir_e|
|00005040| 6e 74 2e 73 74 61 72 74 | 29 20 3a 20 30 3b 0a 09 |nt.start|) : 0;..|
|00005050| 20 20 20 20 69 66 20 28 | 43 46 5f 4c 45 5f 57 28 | if (|CF_LE_W(|
|00005060| 66 69 6c 65 2d 3e 64 69 | 72 5f 65 6e 74 2e 73 74 |file->di|r_ent.st|
|00005070| 61 72 74 29 20 21 3d 20 | 65 78 70 65 63 74 29 20 |art) != |expect) |
|00005080| 7b 0a 09 09 70 72 69 6e | 74 66 28 22 25 73 5c 6e |{...prin|tf("%s\n|
|00005090| 20 20 53 74 61 72 74 20 | 28 25 64 29 20 64 6f 65 | Start |(%d) doe|
|000050a0| 73 20 6e 6f 74 20 70 6f | 69 6e 74 20 74 6f 20 2e |s not po|int to .|
|000050b0| 2e 20 28 25 64 29 5c 6e | 22 2c 0a 09 09 20 20 70 |. (%d)\n|",... p|
|000050c0| 61 74 68 5f 6e 61 6d 65 | 28 66 69 6c 65 29 2c 43 |ath_name|(file),C|
|000050d0| 46 5f 4c 45 5f 57 28 66 | 69 6c 65 2d 3e 64 69 72 |F_LE_W(f|ile->dir|
|000050e0| 5f 65 6e 74 2e 73 74 61 | 72 74 29 2c 65 78 70 65 |_ent.sta|rt),expe|
|000050f0| 63 74 29 3b 0a 09 09 4d | 4f 44 49 46 59 28 66 69 |ct);...M|ODIFY(fi|
|00005100| 6c 65 2c 73 74 61 72 74 | 2c 43 54 5f 4c 45 5f 57 |le,start|,CT_LE_W|
|00005110| 28 65 78 70 65 63 74 29 | 29 3b 0a 09 20 20 20 20 |(expect)|);.. |
|00005120| 7d 0a 09 20 20 20 20 72 | 65 74 75 72 6e 20 30 3b |}.. r|eturn 0;|
|00005130| 0a 09 7d 0a 20 20 20 20 | 7d 0a 20 20 20 20 69 66 |..}. |}. if|
|00005140| 20 28 43 46 5f 4c 45 5f | 57 28 66 69 6c 65 2d 3e | (CF_LE_|W(file->|
|00005150| 64 69 72 5f 65 6e 74 2e | 73 74 61 72 74 29 20 3e |dir_ent.|start) >|
|00005160| 3d 20 66 73 2d 3e 63 6c | 75 73 74 65 72 73 2b 32 |= fs->cl|usters+2|
|00005170| 29 20 7b 0a 09 70 72 69 | 6e 74 66 28 22 25 73 5c |) {..pri|ntf("%s\|
|00005180| 6e 20 20 53 74 61 72 74 | 20 63 6c 75 73 74 65 72 |n Start| cluster|
|00005190| 20 62 65 79 6f 6e 64 20 | 6c 69 6d 69 74 20 28 25 | beyond |limit (%|
|000051a0| 75 20 3e 20 25 64 29 2e | 20 54 72 75 6e 63 61 74 |u > %d).| Truncat|
|000051b0| 69 6e 67 20 66 69 6c 65 | 2e 5c 6e 22 2c 0a 09 20 |ing file|.\n",.. |
|000051c0| 20 70 61 74 68 5f 6e 61 | 6d 65 28 66 69 6c 65 29 | path_na|me(file)|
|000051d0| 2c 43 46 5f 4c 45 5f 57 | 28 66 69 6c 65 2d 3e 64 |,CF_LE_W|(file->d|
|000051e0| 69 72 5f 65 6e 74 2e 73 | 74 61 72 74 29 2c 66 73 |ir_ent.s|tart),fs|
|000051f0| 2d 3e 63 6c 75 73 74 65 | 72 73 2b 31 29 3b 0a 09 |->cluste|rs+1);..|
|00005200| 4d 4f 44 49 46 59 28 66 | 69 6c 65 2c 73 74 61 72 |MODIFY(f|ile,star|
|00005210| 74 2c 43 54 5f 4c 45 5f | 57 28 30 29 29 3b 0a 20 |t,CT_LE_|W(0));. |
|00005220| 20 20 20 7d 0a 20 20 20 | 20 63 6c 75 73 74 65 72 | }. | cluster|
|00005230| 73 20 3d 20 70 72 65 76 | 20 3d 20 30 3b 0a 20 20 |s = prev| = 0;. |
|00005240| 20 20 66 6f 72 20 28 63 | 75 72 72 20 3d 20 43 46 | for (c|urr = CF|
|00005250| 5f 4c 45 5f 57 28 66 69 | 6c 65 2d 3e 64 69 72 5f |_LE_W(fi|le->dir_|
|00005260| 65 6e 74 2e 73 74 61 72 | 74 29 20 3f 20 43 46 5f |ent.star|t) ? CF_|
|00005270| 4c 45 5f 57 28 66 69 6c | 65 2d 3e 64 69 72 5f 65 |LE_W(fil|e->dir_e|
|00005280| 6e 74 2e 73 74 61 72 74 | 29 20 3a 0a 20 20 20 20 |nt.start|) :. |
|00005290| 20 20 2d 31 3b 20 63 75 | 72 72 20 21 3d 20 2d 31 | -1; cu|rr != -1|
|000052a0| 3b 20 63 75 72 72 20 3d | 20 6e 65 78 74 5f 63 6c |; curr =| next_cl|
|000052b0| 75 73 74 65 72 28 66 73 | 2c 63 75 72 72 29 29 20 |uster(fs|,curr)) |
|000052c0| 7b 0a 09 69 66 20 28 21 | 66 73 2d 3e 66 61 74 5b |{..if (!|fs->fat[|
|000052d0| 63 75 72 72 5d 2e 76 61 | 6c 75 65 20 7c 7c 20 62 |curr].va|lue || b|
|000052e0| 61 64 5f 63 6c 75 73 74 | 65 72 28 66 73 2c 63 75 |ad_clust|er(fs,cu|
|000052f0| 72 72 29 29 20 7b 0a 09 | 20 20 20 20 70 72 69 6e |rr)) {..| prin|
|00005300| 74 66 28 22 25 73 5c 6e | 20 20 43 6f 6e 74 61 69 |tf("%s\n| Contai|
|00005310| 6e 73 20 61 20 25 73 20 | 63 6c 75 73 74 65 72 20 |ns a %s |cluster |
|00005320| 28 25 64 29 2e 20 41 73 | 73 75 6d 69 6e 67 20 45 |(%d). As|suming E|
|00005330| 4f 46 2e 5c 6e 22 2c 0a | 09 20 20 20 20 20 20 70 |OF.\n",.|. p|
|00005340| 61 74 68 5f 6e 61 6d 65 | 28 66 69 6c 65 29 2c 66 |ath_name|(file),f|
|00005350| 73 2d 3e 66 61 74 5b 63 | 75 72 72 5d 2e 76 61 6c |s->fat[c|urr].val|
|00005360| 75 65 20 3f 20 22 62 61 | 64 22 20 3a 20 22 66 72 |ue ? "ba|d" : "fr|
|00005370| 65 65 22 2c 63 75 72 72 | 29 3b 0a 09 20 20 20 20 |ee",curr|);.. |
|00005380| 69 66 20 28 70 72 65 76 | 29 20 73 65 74 5f 66 61 |if (prev|) set_fa|
|00005390| 74 28 66 73 2c 70 72 65 | 76 2c 2d 31 29 3b 0a 09 |t(fs,pre|v,-1);..|
|000053a0| 20 20 20 20 65 6c 73 65 | 20 4d 4f 44 49 46 59 28 | else| MODIFY(|
|000053b0| 66 69 6c 65 2c 73 74 61 | 72 74 2c 43 54 5f 4c 45 |file,sta|rt,CT_LE|
|000053c0| 5f 57 28 30 29 29 3b 0a | 09 20 20 20 20 62 72 65 |_W(0));.|. bre|
|000053d0| 61 6b 3b 0a 09 7d 0a 09 | 69 66 20 28 21 28 66 69 |ak;..}..|if (!(fi|
|000053e0| 6c 65 2d 3e 64 69 72 5f | 65 6e 74 2e 61 74 74 72 |le->dir_|ent.attr|
|000053f0| 20 26 20 41 54 54 52 5f | 44 49 52 29 20 26 26 20 | & ATTR_|DIR) && |
|00005400| 43 46 5f 4c 45 5f 4c 28 | 66 69 6c 65 2d 3e 64 69 |CF_LE_L(|file->di|
|00005410| 72 5f 65 6e 74 2e 73 69 | 7a 65 29 20 3c 3d 0a 09 |r_ent.si|ze) <=..|
|00005420| 20 20 63 6c 75 73 74 65 | 72 73 2a 66 73 2d 3e 63 | cluste|rs*fs->c|
|00005430| 6c 75 73 74 65 72 5f 73 | 69 7a 65 29 20 7b 0a 09 |luster_s|ize) {..|
|00005440| 20 20 20 20 70 72 69 6e | 74 66 28 22 25 73 5c 6e | prin|tf("%s\n|
|00005450| 20 20 46 69 6c 65 20 73 | 69 7a 65 20 69 73 20 25 | File s|ize is %|
|00005460| 75 20 62 79 74 65 73 2c | 20 63 6c 75 73 74 65 72 |u bytes,| cluster|
|00005470| 20 63 68 61 69 6e 20 6c | 65 6e 67 74 68 20 69 73 | chain l|ength is|
|00005480| 20 3e 20 25 75 20 22 0a | 09 20 20 20 20 20 20 22 | > %u ".|. "|
|00005490| 62 79 74 65 73 2e 5c 6e | 20 20 54 72 75 6e 63 61 |bytes.\n| Trunca|
|000054a0| 74 69 6e 67 20 66 69 6c | 65 20 74 6f 20 25 75 20 |ting fil|e to %u |
|000054b0| 62 79 74 65 73 2e 5c 6e | 22 2c 70 61 74 68 5f 6e |bytes.\n|",path_n|
|000054c0| 61 6d 65 28 66 69 6c 65 | 29 2c 0a 09 20 20 20 20 |ame(file|),.. |
|000054d0| 20 20 43 46 5f 4c 45 5f | 4c 28 66 69 6c 65 2d 3e | CF_LE_|L(file->|
|000054e0| 64 69 72 5f 65 6e 74 2e | 73 69 7a 65 29 2c 63 6c |dir_ent.|size),cl|
|000054f0| 75 73 74 65 72 73 2a 66 | 73 2d 3e 63 6c 75 73 74 |usters*f|s->clust|
|00005500| 65 72 5f 73 69 7a 65 2c | 0a 09 20 20 20 20 20 20 |er_size,|.. |
|00005510| 43 46 5f 4c 45 5f 4c 28 | 66 69 6c 65 2d 3e 64 69 |CF_LE_L(|file->di|
|00005520| 72 5f 65 6e 74 2e 73 69 | 7a 65 29 29 3b 0a 09 20 |r_ent.si|ze));.. |
|00005530| 20 20 20 74 72 75 6e 63 | 61 74 65 5f 66 69 6c 65 | trunc|ate_file|
|00005540| 28 66 73 2c 66 69 6c 65 | 2c 63 6c 75 73 74 65 72 |(fs,file|,cluster|
|00005550| 73 29 3b 0a 09 20 20 20 | 20 62 72 65 61 6b 3b 0a |s);.. | break;.|
|00005560| 09 7d 0a 09 69 66 20 28 | 6f 77 6e 65 72 20 3d 20 |.}..if (|owner = |
|00005570| 67 65 74 5f 6f 77 6e 65 | 72 28 66 73 2c 63 75 72 |get_owne|r(fs,cur|
|00005580| 72 29 29 20 7b 0a 09 20 | 20 20 20 70 72 69 6e 74 |r)) {.. | print|
|00005590| 66 28 22 25 73 20 20 61 | 6e 64 5c 6e 22 2c 70 61 |f("%s a|nd\n",pa|
|000055a0| 74 68 5f 6e 61 6d 65 28 | 6f 77 6e 65 72 29 29 3b |th_name(|owner));|
|000055b0| 0a 09 20 20 20 20 70 72 | 69 6e 74 66 28 22 25 73 |.. pr|intf("%s|
|000055c0| 5c 6e 20 20 73 68 61 72 | 65 20 63 6c 75 73 74 65 |\n shar|e cluste|
|000055d0| 72 73 2e 5c 6e 22 2c 70 | 61 74 68 5f 6e 61 6d 65 |rs.\n",p|ath_name|
|000055e0| 28 66 69 6c 65 29 29 3b | 0a 09 20 20 20 20 63 6c |(file));|.. cl|
|000055f0| 75 73 74 65 72 73 32 20 | 3d 20 30 3b 0a 09 20 20 |usters2 |= 0;.. |
|00005600| 20 20 66 6f 72 20 28 77 | 61 6c 6b 20 3d 20 43 46 | for (w|alk = CF|
|00005610| 5f 4c 45 5f 57 28 6f 77 | 6e 65 72 2d 3e 64 69 72 |_LE_W(ow|ner->dir|
|00005620| 5f 65 6e 74 2e 73 74 61 | 72 74 29 3b 20 77 61 6c |_ent.sta|rt); wal|
|00005630| 6b 20 3e 20 30 3b 20 77 | 61 6c 6b 20 3d 0a 09 20 |k > 0; w|alk =.. |
|00005640| 20 20 20 20 20 6e 65 78 | 74 5f 63 6c 75 73 74 65 | nex|t_cluste|
|00005650| 72 28 66 73 2c 77 61 6c | 6b 29 29 0a 09 09 69 66 |r(fs,wal|k))...if|
|00005660| 20 28 77 61 6c 6b 20 3d | 3d 20 63 75 72 72 29 20 | (walk =|= curr) |
|00005670| 62 72 65 61 6b 3b 0a 09 | 09 65 6c 73 65 20 63 6c |break;..|.else cl|
|00005680| 75 73 74 65 72 73 32 2b | 2b 3b 0a 09 20 20 20 20 |usters2+|+;.. |
|00005690| 72 65 73 74 61 72 74 20 | 3d 20 66 69 6c 65 2d 3e |restart |= file->|
|000056a0| 64 69 72 5f 65 6e 74 2e | 61 74 74 72 20 26 20 41 |dir_ent.|attr & A|
|000056b0| 54 54 52 5f 44 49 52 3b | 0a 09 20 20 20 20 69 66 |TTR_DIR;|.. if|
|000056c0| 20 28 69 6e 74 65 72 61 | 63 74 69 76 65 29 0a 09 | (intera|ctive)..|
|000056d0| 09 70 72 69 6e 74 66 28 | 22 31 29 20 54 72 75 6e |.printf(|"1) Trun|
|000056e0| 63 61 74 65 20 66 69 72 | 73 74 20 74 6f 20 25 75 |cate fir|st to %u|
|000056f0| 20 62 79 74 65 73 25 73 | 5c 6e 22 0a 09 09 20 20 | bytes%s|\n"... |
|00005700| 22 32 29 20 54 72 75 6e | 63 61 74 65 20 73 65 63 |"2) Trun|cate sec|
|00005710| 6f 6e 64 20 74 6f 20 25 | 75 20 62 79 74 65 73 5c |ond to %|u bytes\|
|00005720| 6e 22 2c 63 6c 75 73 74 | 65 72 73 2a 66 73 2d 3e |n",clust|ers*fs->|
|00005730| 63 6c 75 73 74 65 72 5f | 73 69 7a 65 2c 0a 09 09 |cluster_|size,...|
|00005740| 20 20 72 65 73 74 61 72 | 74 20 3f 20 22 20 61 6e | restar|t ? " an|
|00005750| 64 20 72 65 73 74 61 72 | 74 22 20 3a 20 22 22 2c |d restar|t" : "",|
|00005760| 63 6c 75 73 74 65 72 73 | 32 2a 66 73 2d 3e 63 6c |clusters|2*fs->cl|
|00005770| 75 73 74 65 72 5f 73 69 | 7a 65 29 3b 0a 09 20 20 |uster_si|ze);.. |
|00005780| 20 20 65 6c 73 65 20 70 | 72 69 6e 74 66 28 22 20 | else p|rintf(" |
|00005790| 20 54 72 75 6e 63 61 74 | 69 6e 67 20 73 65 63 6f | Truncat|ing seco|
|000057a0| 6e 64 20 74 6f 20 25 75 | 20 62 79 74 65 73 2e 5c |nd to %u| bytes.\|
|000057b0| 6e 22 2c 63 6c 75 73 74 | 65 72 73 32 2a 0a 09 09 |n",clust|ers2*...|
|000057c0| 20 20 66 73 2d 3e 63 6c | 75 73 74 65 72 5f 73 69 | fs->cl|uster_si|
|000057d0| 7a 65 29 3b 0a 09 20 20 | 20 20 69 66 20 28 69 6e |ze);.. | if (in|
|000057e0| 74 65 72 61 63 74 69 76 | 65 20 26 26 20 67 65 74 |teractiv|e && get|
|000057f0| 5f 6b 65 79 28 22 31 32 | 22 2c 22 3f 22 29 20 3d |_key("12|","?") =|
|00005800| 3d 20 27 31 27 29 20 7b | 0a 09 09 70 72 65 76 20 |= '1') {|...prev |
|00005810| 3d 20 30 3b 0a 09 09 63 | 6c 75 73 74 65 72 73 20 |= 0;...c|lusters |
|00005820| 3d 20 30 3b 0a 09 09 66 | 6f 72 20 28 74 68 69 73 |= 0;...f|or (this|
|00005830| 20 3d 20 43 46 5f 4c 45 | 5f 57 28 6f 77 6e 65 72 | = CF_LE|_W(owner|
|00005840| 2d 3e 64 69 72 5f 65 6e | 74 2e 73 74 61 72 74 29 |->dir_en|t.start)|
|00005850| 3b 20 74 68 69 73 20 3e | 20 30 3b 20 74 68 69 73 |; this >| 0; this|
|00005860| 20 3d 0a 09 09 20 20 6e | 65 78 74 5f 63 6c 75 73 | =... n|ext_clus|
|00005870| 74 65 72 28 66 73 2c 74 | 68 69 73 29 29 20 7b 0a |ter(fs,t|his)) {.|
|00005880| 09 09 20 20 20 20 69 66 | 20 28 74 68 69 73 20 3d |.. if| (this =|
|00005890| 3d 20 63 75 72 72 29 20 | 7b 0a 09 09 09 69 66 20 |= curr) |{....if |
|000058a0| 28 70 72 65 76 29 20 73 | 65 74 5f 66 61 74 28 66 |(prev) s|et_fat(f|
|000058b0| 73 2c 70 72 65 76 2c 2d | 31 29 3b 0a 09 09 09 65 |s,prev,-|1);....e|
|000058c0| 6c 73 65 20 4d 4f 44 49 | 46 59 28 6f 77 6e 65 72 |lse MODI|FY(owner|
|000058d0| 2c 73 74 61 72 74 2c 43 | 54 5f 4c 45 5f 57 28 30 |,start,C|T_LE_W(0|
|000058e0| 29 29 3b 0a 09 09 09 4d | 4f 44 49 46 59 28 6f 77 |));....M|ODIFY(ow|
|000058f0| 6e 65 72 2c 73 69 7a 65 | 2c 43 54 5f 4c 45 5f 4c |ner,size|,CT_LE_L|
|00005900| 28 63 6c 75 73 74 65 72 | 73 2a 66 73 2d 3e 63 6c |(cluster|s*fs->cl|
|00005910| 75 73 74 65 72 5f 73 69 | 7a 65 29 29 3b 0a 09 09 |uster_si|ze));...|
|00005920| 09 69 66 20 28 72 65 73 | 74 61 72 74 29 20 72 65 |.if (res|tart) re|
|00005930| 74 75 72 6e 20 31 3b 0a | 09 09 09 77 68 69 6c 65 |turn 1;.|...while|
|00005940| 20 28 74 68 69 73 20 3e | 20 30 29 20 7b 0a 09 09 | (this >| 0) {...|
|00005950| 09 20 20 20 20 73 65 74 | 5f 6f 77 6e 65 72 28 66 |. set|_owner(f|
|00005960| 73 2c 74 68 69 73 2c 4e | 55 4c 4c 29 3b 0a 09 09 |s,this,N|ULL);...|
|00005970| 09 20 20 20 20 74 68 69 | 73 20 3d 20 6e 65 78 74 |. thi|s = next|
|00005980| 5f 63 6c 75 73 74 65 72 | 28 66 73 2c 74 68 69 73 |_cluster|(fs,this|
|00005990| 29 3b 0a 09 09 09 7d 0a | 09 09 09 62 72 65 61 6b |);....}.|...break|
|000059a0| 3b 0a 09 09 20 20 20 20 | 7d 0a 09 09 20 20 20 20 |;... |}... |
|000059b0| 63 6c 75 73 74 65 72 73 | 2b 2b 3b 0a 09 09 20 20 |clusters|++;... |
|000059c0| 20 20 70 72 65 76 20 3d | 20 74 68 69 73 3b 0a 09 | prev =| this;..|
|000059d0| 09 7d 0a 09 09 69 66 20 | 28 74 68 69 73 20 21 3d |.}...if |(this !=|
|000059e0| 20 63 75 72 72 29 0a 09 | 09 20 20 20 20 64 69 65 | curr)..|. die|
|000059f0| 28 22 49 6e 74 65 72 6e | 61 6c 20 65 72 72 6f 72 |("Intern|al error|
|00005a00| 3a 20 64 69 64 6e 27 74 | 20 66 69 6e 64 20 63 6c |: didn't| find cl|
|00005a10| 75 73 74 65 72 20 25 64 | 20 69 6e 20 63 68 61 69 |uster %d| in chai|
|00005a20| 6e 22 0a 09 09 20 20 20 | 20 20 20 22 20 73 74 61 |n"... | " sta|
|00005a30| 72 74 69 6e 67 20 61 74 | 20 25 64 22 2c 63 75 72 |rting at| %d",cur|
|00005a40| 72 2c 43 46 5f 4c 45 5f | 57 28 6f 77 6e 65 72 2d |r,CF_LE_|W(owner-|
|00005a50| 3e 64 69 72 5f 65 6e 74 | 2e 73 74 61 72 74 29 29 |>dir_ent|.start))|
|00005a60| 3b 0a 09 20 20 20 20 7d | 0a 09 20 20 20 20 65 6c |;.. }|.. el|
|00005a70| 73 65 20 7b 0a 09 09 69 | 66 20 28 70 72 65 76 29 |se {...i|f (prev)|
|00005a80| 20 73 65 74 5f 66 61 74 | 28 66 73 2c 70 72 65 76 | set_fat|(fs,prev|
|00005a90| 2c 2d 31 29 3b 0a 09 09 | 65 6c 73 65 20 4d 4f 44 |,-1);...|else MOD|
|00005aa0| 49 46 59 28 66 69 6c 65 | 2c 73 74 61 72 74 2c 43 |IFY(file|,start,C|
|00005ab0| 54 5f 4c 45 5f 57 28 30 | 29 29 3b 0a 09 09 62 72 |T_LE_W(0|));...br|
|00005ac0| 65 61 6b 3b 0a 09 20 20 | 20 20 7d 0a 09 7d 0a 09 |eak;.. | }..}..|
|00005ad0| 73 65 74 5f 6f 77 6e 65 | 72 28 66 73 2c 63 75 72 |set_owne|r(fs,cur|
|00005ae0| 72 2c 66 69 6c 65 29 3b | 0a 09 63 6c 75 73 74 65 |r,file);|..cluste|
|00005af0| 72 73 2b 2b 3b 0a 09 70 | 72 65 76 20 3d 20 63 75 |rs++;..p|rev = cu|
|00005b00| 72 72 3b 0a 20 20 20 20 | 7d 0a 20 20 20 20 69 66 |rr;. |}. if|
|00005b10| 20 28 21 28 66 69 6c 65 | 2d 3e 64 69 72 5f 65 6e | (!(file|->dir_en|
|00005b20| 74 2e 61 74 74 72 20 26 | 20 41 54 54 52 5f 44 49 |t.attr &| ATTR_DI|
|00005b30| 52 29 20 26 26 20 43 46 | 5f 4c 45 5f 4c 28 66 69 |R) && CF|_LE_L(fi|
|00005b40| 6c 65 2d 3e 64 69 72 5f | 65 6e 74 2e 73 69 7a 65 |le->dir_|ent.size|
|00005b50| 29 20 3e 0a 20 20 20 20 | 20 20 63 6c 75 73 74 65 |) >. | cluste|
|00005b60| 72 73 2a 66 73 2d 3e 63 | 6c 75 73 74 65 72 5f 73 |rs*fs->c|luster_s|
|00005b70| 69 7a 65 29 20 7b 0a 09 | 70 72 69 6e 74 66 28 22 |ize) {..|printf("|
|00005b80| 25 73 5c 6e 20 20 46 69 | 6c 65 20 73 69 7a 65 20 |%s\n Fi|le size |
|00005b90| 69 73 20 25 75 20 62 79 | 74 65 73 2c 20 63 6c 75 |is %u by|tes, clu|
|00005ba0| 73 74 65 72 20 63 68 61 | 69 6e 20 6c 65 6e 67 74 |ster cha|in lengt|
|00005bb0| 68 20 69 73 20 25 75 20 | 62 79 74 65 73 2e 22 0a |h is %u |bytes.".|
|00005bc0| 09 20 20 22 5c 6e 20 20 | 54 72 75 6e 63 61 74 69 |. "\n |Truncati|
|00005bd0| 6e 67 20 66 69 6c 65 20 | 74 6f 20 25 75 20 62 79 |ng file |to %u by|
|00005be0| 74 65 73 2e 5c 6e 22 2c | 70 61 74 68 5f 6e 61 6d |tes.\n",|path_nam|
|00005bf0| 65 28 66 69 6c 65 29 2c | 43 46 5f 4c 45 5f 4c 28 |e(file),|CF_LE_L(|
|00005c00| 66 69 6c 65 2d 3e 0a 09 | 20 20 64 69 72 5f 65 6e |file->..| dir_en|
|00005c10| 74 2e 73 69 7a 65 29 2c | 63 6c 75 73 74 65 72 73 |t.size),|clusters|
|00005c20| 2a 66 73 2d 3e 63 6c 75 | 73 74 65 72 5f 73 69 7a |*fs->clu|ster_siz|
|00005c30| 65 2c 63 6c 75 73 74 65 | 72 73 2a 66 73 2d 3e 63 |e,cluste|rs*fs->c|
|00005c40| 6c 75 73 74 65 72 5f 73 | 69 7a 65 29 3b 0a 09 4d |luster_s|ize);..M|
|00005c50| 4f 44 49 46 59 28 66 69 | 6c 65 2c 73 69 7a 65 2c |ODIFY(fi|le,size,|
|00005c60| 43 54 5f 4c 45 5f 4c 28 | 63 6c 75 73 74 65 72 73 |CT_LE_L(|clusters|
|00005c70| 2a 66 73 2d 3e 63 6c 75 | 73 74 65 72 5f 73 69 7a |*fs->clu|ster_siz|
|00005c80| 65 29 29 3b 0a 20 20 20 | 20 7d 0a 20 20 20 20 72 |e));. | }. r|
|00005c90| 65 74 75 72 6e 20 30 3b | 0a 7d 0a 0a 0a 73 74 61 |eturn 0;|.}...sta|
|00005ca0| 74 69 63 20 69 6e 74 20 | 63 68 65 63 6b 5f 66 69 |tic int |check_fi|
|00005cb0| 6c 65 73 28 44 4f 53 5f | 46 53 20 2a 66 73 2c 44 |les(DOS_|FS *fs,D|
|00005cc0| 4f 53 5f 46 49 4c 45 20 | 2a 73 74 61 72 74 29 0a |OS_FILE |*start).|
|00005cd0| 7b 0a 20 20 20 20 77 68 | 69 6c 65 20 28 73 74 61 |{. wh|ile (sta|
|00005ce0| 72 74 29 20 7b 0a 09 69 | 66 20 28 63 68 65 63 6b |rt) {..i|f (check|
|00005cf0| 5f 66 69 6c 65 28 66 73 | 2c 73 74 61 72 74 29 29 |_file(fs|,start))|
|00005d00| 20 72 65 74 75 72 6e 20 | 31 3b 0a 09 73 74 61 72 | return |1;..star|
|00005d10| 74 20 3d 20 73 74 61 72 | 74 2d 3e 6e 65 78 74 3b |t = star|t->next;|
|00005d20| 0a 20 20 20 20 7d 0a 20 | 20 20 20 72 65 74 75 72 |. }. | retur|
|00005d30| 6e 20 30 3b 0a 7d 0a 0a | 0a 73 74 61 74 69 63 20 |n 0;.}..|.static |
|00005d40| 69 6e 74 20 63 68 65 63 | 6b 5f 64 69 72 28 44 4f |int chec|k_dir(DO|
|00005d50| 53 5f 46 53 20 2a 66 73 | 2c 44 4f 53 5f 46 49 4c |S_FS *fs|,DOS_FIL|
|00005d60| 45 20 2a 2a 72 6f 6f 74 | 2c 69 6e 74 20 64 6f 74 |E **root|,int dot|
|00005d70| 73 29 0a 7b 0a 20 20 20 | 20 44 4f 53 5f 46 49 4c |s).{. | DOS_FIL|
|00005d80| 45 20 2a 70 61 72 65 6e | 74 2c 2a 2a 77 61 6c 6b |E *paren|t,**walk|
|00005d90| 2c 2a 2a 73 63 61 6e 3b | 0a 20 20 20 20 69 6e 74 |,**scan;|. int|
|00005da0| 20 64 6f 74 2c 64 6f 74 | 64 6f 74 2c 73 6b 69 70 | dot,dot|dot,skip|
|00005db0| 2c 72 65 64 6f 3b 0a 20 | 20 20 20 69 6e 74 20 67 |,redo;. | int g|
|00005dc0| 6f 6f 64 2c 62 61 64 3b | 0a 0a 20 20 20 20 69 66 |ood,bad;|.. if|
|00005dd0| 20 28 21 2a 72 6f 6f 74 | 29 20 72 65 74 75 72 6e | (!*root|) return|
|00005de0| 20 30 3b 0a 20 20 20 20 | 70 61 72 65 6e 74 20 3d | 0;. |parent =|
|00005df0| 20 28 2a 72 6f 6f 74 29 | 2d 3e 70 61 72 65 6e 74 | (*root)|->parent|
|00005e00| 3b 0a 20 20 20 20 67 6f | 6f 64 20 3d 20 62 61 64 |;. go|od = bad|
|00005e10| 20 3d 20 30 3b 0a 20 20 | 20 20 66 6f 72 20 28 77 | = 0;. | for (w|
|00005e20| 61 6c 6b 20 3d 20 72 6f | 6f 74 3b 20 2a 77 61 6c |alk = ro|ot; *wal|
|00005e30| 6b 3b 20 77 61 6c 6b 20 | 3d 20 26 28 2a 77 61 6c |k; walk |= &(*wal|
|00005e40| 6b 29 2d 3e 6e 65 78 74 | 29 0a 09 69 66 20 28 62 |k)->next|)..if (b|
|00005e50| 61 64 5f 6e 61 6d 65 28 | 28 2a 77 61 6c 6b 29 2d |ad_name(|(*walk)-|
|00005e60| 3e 64 69 72 5f 65 6e 74 | 2e 6e 61 6d 65 29 29 20 |>dir_ent|.name)) |
|00005e70| 62 61 64 2b 2b 3b 0a 09 | 65 6c 73 65 20 67 6f 6f |bad++;..|else goo|
|00005e80| 64 2b 2b 3b 0a 20 20 20 | 20 69 66 20 28 2a 72 6f |d++;. | if (*ro|
|00005e90| 6f 74 20 26 26 20 70 61 | 72 65 6e 74 20 26 26 20 |ot && pa|rent && |
|00005ea0| 67 6f 6f 64 2b 62 61 64 | 20 3e 20 34 20 26 26 20 |good+bad| > 4 && |
|00005eb0| 62 61 64 20 3e 20 67 6f | 6f 64 2f 32 29 20 7b 0a |bad > go|od/2) {.|
|00005ec0| 09 70 72 69 6e 74 66 28 | 22 25 73 5c 6e 20 20 48 |.printf(|"%s\n H|
|00005ed0| 61 73 20 61 20 6c 61 72 | 67 65 20 6e 75 6d 62 65 |as a lar|ge numbe|
|00005ee0| 72 20 6f 66 20 62 61 64 | 20 65 6e 74 72 69 65 73 |r of bad| entries|
|00005ef0| 2e 20 28 25 64 2f 25 64 | 29 5c 6e 22 2c 0a 09 20 |. (%d/%d|)\n",.. |
|00005f00| 20 70 61 74 68 5f 6e 61 | 6d 65 28 70 61 72 65 6e | path_na|me(paren|
|00005f10| 74 29 2c 62 61 64 2c 67 | 6f 6f 64 2b 62 61 64 29 |t),bad,g|ood+bad)|
|00005f20| 3b 0a 09 69 66 20 28 21 | 69 6e 74 65 72 61 63 74 |;..if (!|interact|
|00005f30| 69 76 65 29 20 70 72 69 | 6e 74 66 28 22 20 20 44 |ive) pri|ntf(" D|
|00005f40| 72 6f 70 70 69 6e 67 20 | 69 74 2e 5c 6e 22 29 3b |ropping |it.\n");|
|00005f50| 0a 09 69 66 20 28 21 69 | 6e 74 65 72 61 63 74 69 |..if (!i|nteracti|
|00005f60| 76 65 20 7c 7c 20 67 65 | 74 5f 6b 65 79 28 22 79 |ve || ge|t_key("y|
|00005f70| 6e 22 2c 22 44 72 6f 70 | 20 64 69 72 65 63 74 6f |n","Drop| directo|
|00005f80| 72 79 20 3f 20 28 79 2f | 6e 29 22 29 20 3d 3d 20 |ry ? (y/|n)") == |
|00005f90| 27 79 27 29 20 7b 0a 09 | 20 20 20 20 74 72 75 6e |'y') {..| trun|
|00005fa0| 63 61 74 65 5f 66 69 6c | 65 28 66 73 2c 70 61 72 |cate_fil|e(fs,par|
|00005fb0| 65 6e 74 2c 30 29 3b 0a | 09 20 20 20 20 4d 4f 44 |ent,0);.|. MOD|
|00005fc0| 49 46 59 28 70 61 72 65 | 6e 74 2c 6e 61 6d 65 5b |IFY(pare|nt,name[|
|00005fd0| 30 5d 2c 44 45 4c 45 54 | 45 44 5f 46 4c 41 47 29 |0],DELET|ED_FLAG)|
|00005fe0| 3b 0a 09 20 20 20 20 2f | 2a 20 62 75 67 6c 65 74 |;.. /|* buglet|
|00005ff0| 3a 20 64 65 6c 65 74 65 | 64 20 64 69 72 65 63 74 |: delete|d direct|
|00006000| 6f 72 79 20 73 74 61 79 | 73 20 69 6e 20 74 68 65 |ory stay|s in the|
|00006010| 20 6c 69 73 74 2e 20 2a | 2f 0a 09 20 20 20 20 72 | list. *|/.. r|
|00006020| 65 74 75 72 6e 20 31 3b | 0a 09 7d 0a 20 20 20 20 |eturn 1;|..}. |
|00006030| 7d 0a 20 20 20 20 64 6f | 74 20 3d 20 64 6f 74 64 |}. do|t = dotd|
|00006040| 6f 74 20 3d 20 72 65 64 | 6f 20 3d 20 30 3b 0a 20 |ot = red|o = 0;. |
|00006050| 20 20 20 77 61 6c 6b 20 | 3d 20 72 6f 6f 74 3b 0a | walk |= root;.|
|00006060| 20 20 20 20 77 68 69 6c | 65 20 28 2a 77 61 6c 6b | whil|e (*walk|
|00006070| 29 20 7b 0a 09 69 66 20 | 28 21 73 74 72 6e 63 6d |) {..if |(!strncm|
|00006080| 70 28 28 2a 77 61 6c 6b | 29 2d 3e 64 69 72 5f 65 |p((*walk|)->dir_e|
|00006090| 6e 74 2e 6e 61 6d 65 2c | 4d 53 44 4f 53 5f 44 4f |nt.name,|MSDOS_DO|
|000060a0| 54 2c 4d 53 44 4f 53 5f | 4e 41 4d 45 29 20 7c 7c |T,MSDOS_|NAME) |||
|000060b0| 0a 09 20 20 21 73 74 72 | 6e 63 6d 70 28 28 2a 77 |.. !str|ncmp((*w|
|000060c0| 61 6c 6b 29 2d 3e 64 69 | 72 5f 65 6e 74 2e 6e 61 |alk)->di|r_ent.na|
|000060d0| 6d 65 2c 4d 53 44 4f 53 | 5f 44 4f 54 44 4f 54 2c |me,MSDOS|_DOTDOT,|
|000060e0| 4d 53 44 4f 53 5f 4e 41 | 4d 45 29 29 20 7b 0a 09 |MSDOS_NA|ME)) {..|
|000060f0| 20 20 20 20 69 66 20 28 | 68 61 6e 64 6c 65 5f 64 | if (|handle_d|
|00006100| 6f 74 28 66 73 2c 2a 77 | 61 6c 6b 2c 64 6f 74 73 |ot(fs,*w|alk,dots|
|00006110| 29 29 20 7b 0a 09 09 2a | 77 61 6c 6b 20 3d 20 28 |)) {...*|walk = (|
|00006120| 2a 77 61 6c 6b 29 2d 3e | 6e 65 78 74 3b 0a 09 09 |*walk)->|next;...|
|00006130| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 20 20 20 20 7d |continue|;.. }|
|00006140| 0a 09 20 20 20 20 69 66 | 20 28 21 73 74 72 6e 63 |.. if| (!strnc|
|00006150| 6d 70 28 28 2a 77 61 6c | 6b 29 2d 3e 64 69 72 5f |mp((*wal|k)->dir_|
|00006160| 65 6e 74 2e 6e 61 6d 65 | 2c 4d 53 44 4f 53 5f 44 |ent.name|,MSDOS_D|
|00006170| 4f 54 2c 4d 53 44 4f 53 | 5f 4e 41 4d 45 29 29 20 |OT,MSDOS|_NAME)) |
|00006180| 64 6f 74 2b 2b 3b 0a 09 | 20 20 20 20 65 6c 73 65 |dot++;..| else|
|00006190| 20 64 6f 74 64 6f 74 2b | 2b 3b 0a 09 7d 0a 09 69 | dotdot+|+;..}..i|
|000061a0| 66 20 28 62 61 64 5f 6e | 61 6d 65 28 28 2a 77 61 |f (bad_n|ame((*wa|
|000061b0| 6c 6b 29 2d 3e 64 69 72 | 5f 65 6e 74 2e 6e 61 6d |lk)->dir|_ent.nam|
|000061c0| 65 29 29 20 7b 0a 09 20 | 20 20 20 70 72 69 6e 74 |e)) {.. | print|
|000061d0| 66 28 22 25 73 5c 6e 20 | 20 42 61 64 20 66 69 6c |f("%s\n | Bad fil|
|000061e0| 65 20 6e 61 6d 65 2e 5c | 6e 22 2c 70 61 74 68 5f |e name.\|n",path_|
|000061f0| 6e 61 6d 65 28 2a 77 61 | 6c 6b 29 29 3b 0a 09 20 |name(*wa|lk));.. |
|00006200| 20 20 20 69 66 20 28 69 | 6e 74 65 72 61 63 74 69 | if (i|nteracti|
|00006210| 76 65 29 0a 09 09 70 72 | 69 6e 74 66 28 22 31 29 |ve)...pr|intf("1)|
|00006220| 20 44 72 6f 70 20 66 69 | 6c 65 5c 6e 32 29 20 52 | Drop fi|le\n2) R|
|00006230| 65 6e 61 6d 65 20 66 69 | 6c 65 5c 6e 33 29 20 41 |ename fi|le\n3) A|
|00006240| 75 74 6f 2d 72 65 6e 61 | 6d 65 5c 6e 22 0a 09 09 |uto-rena|me\n"...|
|00006250| 20 20 22 34 29 20 4b 65 | 65 70 20 69 74 5c 6e 22 | "4) Ke|ep it\n"|
|00006260| 29 3b 0a 09 20 20 20 20 | 65 6c 73 65 20 70 72 69 |);.. |else pri|
|00006270| 6e 74 66 28 22 20 20 41 | 75 74 6f 2d 72 65 6e 61 |ntf(" A|uto-rena|
|00006280| 6d 69 6e 67 20 69 74 2e | 5c 6e 22 29 3b 0a 09 20 |ming it.|\n");.. |
|00006290| 20 20 20 73 77 69 74 63 | 68 20 28 69 6e 74 65 72 | switc|h (inter|
|000062a0| 61 63 74 69 76 65 20 3f | 20 67 65 74 5f 6b 65 79 |active ?| get_key|
|000062b0| 28 22 31 32 33 34 22 2c | 22 3f 22 29 20 3a 20 27 |("1234",|"?") : '|
|000062c0| 33 27 29 20 7b 0a 09 09 | 63 61 73 65 20 27 31 27 |3') {...|case '1'|
|000062d0| 3a 0a 09 09 20 20 20 20 | 64 72 6f 70 5f 66 69 6c |:... |drop_fil|
|000062e0| 65 28 66 73 2c 2a 77 61 | 6c 6b 29 3b 0a 09 09 20 |e(fs,*wa|lk);... |
|000062f0| 20 20 20 77 61 6c 6b 20 | 3d 20 26 28 2a 77 61 6c | walk |= &(*wal|
|00006300| 6b 29 2d 3e 6e 65 78 74 | 3b 0a 09 09 20 20 20 20 |k)->next|;... |
|00006310| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 09 63 61 73 65 |continue|;...case|
|00006320| 20 27 32 27 3a 0a 09 09 | 20 20 20 20 72 65 6e 61 | '2':...| rena|
|00006330| 6d 65 5f 66 69 6c 65 28 | 2a 77 61 6c 6b 29 3b 0a |me_file(|*walk);.|
|00006340| 09 09 20 20 20 20 72 65 | 64 6f 20 3d 20 31 3b 0a |.. re|do = 1;.|
|00006350| 09 09 20 20 20 20 62 72 | 65 61 6b 3b 0a 09 09 63 |.. br|eak;...c|
|00006360| 61 73 65 20 27 33 27 3a | 0a 09 09 20 20 20 20 61 |ase '3':|... a|
|00006370| 75 74 6f 5f 72 65 6e 61 | 6d 65 28 2a 77 61 6c 6b |uto_rena|me(*walk|
|00006380| 29 3b 0a 09 09 20 20 20 | 20 70 72 69 6e 74 66 28 |);... | printf(|
|00006390| 22 20 20 52 65 6e 61 6d | 65 64 20 74 6f 20 25 73 |" Renam|ed to %s|
|000063a0| 5c 6e 22 2c 66 69 6c 65 | 5f 6e 61 6d 65 28 28 2a |\n",file|_name((*|
|000063b0| 77 61 6c 6b 29 2d 3e 64 | 69 72 5f 65 6e 74 2e 0a |walk)->d|ir_ent..|
|000063c0| 09 09 20 20 20 20 20 20 | 6e 61 6d 65 29 29 3b 0a |.. |name));.|
|000063d0| 09 09 20 20 20 20 62 72 | 65 61 6b 3b 0a 09 09 63 |.. br|eak;...c|
|000063e0| 61 73 65 20 27 34 27 3a | 0a 09 09 20 20 20 20 62 |ase '4':|... b|
|000063f0| 72 65 61 6b 3b 0a 09 20 | 20 20 20 7d 0a 09 7d 0a |reak;.. | }..}.|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.